gcc/gcc/objc/objc-act.c

8359 lines
232 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 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
1995-06-15 13:54:32 +02:00
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, 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"
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"
#define OBJC_VOID_AT_END void_list_node
/* 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. */
#define OBJC_VERSION (flag_next_runtime ? 5 : 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 void synth_module_prologue (void);
static tree objc_build_constructor (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 void build_module_descriptor (void);
static void build_module_initializer_routine (void);
static tree init_module_descriptor (tree);
static tree build_objc_method_call (int, tree, tree, tree, tree);
static void generate_strings (void);
static tree get_proto_encoding (tree);
static void build_selector_translation_table (void);
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);
static void objc_start_function (tree, tree, tree, tree);
static tree start_protocol (enum tree_code, tree, tree);
static tree build_method_decl (enum tree_code, tree, tree, tree);
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 int is_private (tree);
static tree get_super_receiver (void);
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);
static tree build_ivar_template (void);
static tree build_method_template (void);
static tree build_private_template (tree);
static void build_class_template (void);
static void build_selector_template (void);
static void build_category_template (void);
static tree lookup_method_in_hash_lists (tree, int);
static void build_super_template (void);
static tree build_category_initializer (tree, tree, tree, tree, tree, tree);
static tree build_protocol_initializer (tree, tree, tree, tree, tree);
static void synth_forward_declarations (void);
static int ivar_list_length (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 get_class_ivars (tree);
static void generate_ivar_lists (void);
static void generate_dispatch_tables (void);
static void generate_shared_structures (void);
static tree generate_protocol_list (tree);
static void build_protocol_reference (tree);
static tree build_keyword_selector (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 const char *synth_id_with_class_suffix (const char *, tree);
static void generate_static_references (void);
static int check_methods_accessible (tree, tree, int);
static void encode_aggregate_within (tree, int, int, int, int);
static const char *objc_demangle (const char *);
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 size_t hash_func (tree);
static void hash_init (void);
static void hash_enter (hash *, tree);
static hash hash_lookup (hash *, tree);
static void hash_add_attr (hash, tree);
static tree lookup_method (tree, tree);
static tree lookup_method_static (tree, tree, int);
static void add_method_to_hash_list (hash *, tree);
static tree add_class (tree);
static void add_category (tree, tree);
static inline tree lookup_category (tree, tree);
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 get_objc_string_decl (tree, enum string_section);
static tree build_objc_string_decl (enum string_section);
static tree build_selector_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
static void build_selector_table_decl (void);
1996-07-04 00:07:53 +02:00
/* Protocol additions. */
static tree add_protocol (tree);
static tree lookup_protocol (tree);
static void check_protocol_recursively (tree, 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_pointer (tree, int, int);
static void encode_array (tree, int, int);
static void encode_aggregate (tree, int, int);
static void encode_next_bitfield (int);
static void encode_gnu_bitfield (int, tree, int);
static void encode_type (tree, int, int);
static void encode_field_decl (tree, int, int);
1992-01-18 00:15:38 +01:00
static void really_start_method (tree, tree);
static int objc_types_are_equivalent (tree, tree);
static int comp_proto_with_proto (tree, tree);
static tree get_arg_type_list (tree, int, 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);
static tree objc_get_parm_info (int);
static void synth_self_and_ucmd_args (void);
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 void error_with_ivar (const char *, tree);
static char *gen_type_name (tree);
static char *gen_type_name_0 (tree);
static char *gen_method_decl (tree);
static char *gen_declaration (tree);
static void dump_interface (FILE *, tree);
1996-07-04 00:07:53 +02:00
/* Everything else. */
static tree lookup_method_in_protocol_list (tree, tree, int);
static tree lookup_protocol_in_reflist (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_var_decl (tree, const char *);
static void finish_var_decl (tree, tree);
static tree create_field_decl (tree, const char *);
static tree setup_string_decl (void);
static int check_string_class_template (void);
static tree my_build_string (int, const char *);
static void build_objc_symtab_template (void);
static tree init_def_list (tree);
static tree init_objc_symtab (tree);
static tree build_metadata_decl (const char *, tree);
static void forward_declare_categories (void);
static void generate_objc_symtab_decl (void);
static tree build_selector (tree);
static tree build_typed_selector_reference (tree, tree);
static tree build_selector_reference (tree);
static tree build_class_reference_decl (void);
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 build_descriptor_table_initializer (tree, tree);
static tree build_method_prototype_list_template (tree, int);
static tree build_method_prototype_template (void);
static tree objc_method_parm_type (tree);
static int objc_encoded_type_size (tree);
static tree encode_method_prototype (tree);
static tree generate_descriptor_table (tree, const char *, int, tree, tree);
static void generate_method_descriptors (tree);
static void generate_protocol_references (tree);
static void generate_protocols (void);
static void check_ivars (tree, tree);
static tree build_ivar_list_template (tree, int);
static tree build_method_list_template (tree, int);
static tree build_ivar_list_initializer (tree, tree);
static tree generate_ivars_list (tree, const char *, int, tree);
static tree build_dispatch_table_initializer (tree, tree);
static tree generate_dispatch_table (tree, const char *, int, tree);
static tree build_shared_structure_initializer (tree, tree, tree, tree,
tree, int, tree, tree, tree);
static void generate_category (tree);
static tree adjust_type_for_id_default (tree);
static tree check_duplicates (hash, int, int);
static tree receiver_is_class_object (tree, int, int);
static int check_methods (tree, tree, int);
static int conforms_to_protocol (tree, tree);
static void check_protocol (tree, const char *, const char *);
static void check_protocols (tree, const char *, const char *);
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
#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"
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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"
/* 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;
static hashval_t string_hash (const void *);
static int string_eq (const void *, const void *);
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
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;
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. */
instantiate_pending_templates (0);
#endif
/* Finalize Objective-C runtime data. No need to generate tables
and code if only checking syntax. */
if (!flag_syntax_only)
finish_objc ();
1992-01-18 00:15:38 +01:00
if (gen_declaration_file)
fclose (gen_declaration_file);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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
cp_finish_file ();
#endif
1992-01-18 00:15:38 +01:00
}
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)
{
if (objc_implementation_context)
{
finish_class (objc_implementation_context);
objc_ivar_chain = NULL_TREE;
objc_implementation_context = NULL_TREE;
}
else
warning ("`@end' must appear in an @implementation context");
}
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)
{
return build_method_decl (objc_inherit_code, rettype, selector, optparms);
}
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;
}
/* Return 1 if LHS and RHS are compatible types for assignment or
various other operations. Return 0 if they are incompatible, and
return -1 if we choose to not decide (because the types are really
just C types, not ObjC specific ones). When the operation is
REFLEXIVE (typically comparisons), check for compatibility in
either direction; when it's not (typically assignments), don't.
This function is called in two cases: when both lhs and rhs are
pointers to records (in which case we check protocols too), and
when both lhs and rhs are records (in which case we check class
inheritance only).
Warnings about classes/protocols not implementing a protocol are
emitted here (multiple of those warnings might be emitted for a
single line!); generic warnings about incompatible assignments and
lacks of casts in comparisons are/must be emitted by the caller if
we return 0.
*/
1992-01-18 00:15:38 +01:00
int
objc_comptypes (tree lhs, tree rhs, int reflexive)
1992-01-18 00:15:38 +01:00
{
1996-07-04 00:07:53 +02:00
/* New clause for protocols. */
/* Here we manage the case of a POINTER_TYPE = POINTER_TYPE. We only
manage the ObjC ones, and leave the rest to the C code. */
if (TREE_CODE (lhs) == POINTER_TYPE
&& TREE_CODE (TREE_TYPE (lhs)) == RECORD_TYPE
&& TREE_CODE (rhs) == POINTER_TYPE
&& TREE_CODE (TREE_TYPE (rhs)) == RECORD_TYPE)
{
int lhs_is_proto = IS_PROTOCOL_QUALIFIED_ID (lhs);
int rhs_is_proto = IS_PROTOCOL_QUALIFIED_ID (rhs);
if (lhs_is_proto)
{
tree lproto, lproto_list = TYPE_PROTOCOL_LIST (lhs);
tree rproto, rproto_list;
tree p;
/* <Protocol> = <Protocol> */
if (rhs_is_proto)
{
rproto_list = TYPE_PROTOCOL_LIST (rhs);
if (!reflexive)
{
/* An assignment between objects of type 'id
<Protocol>'; make sure the protocol on the lhs is
supported by the object on the rhs. */
for (lproto = lproto_list; lproto;
lproto = TREE_CHAIN (lproto))
{
p = TREE_VALUE (lproto);
rproto = lookup_protocol_in_reflist (rproto_list, p);
if (!rproto)
warning
("object does not conform to the `%s' protocol",
IDENTIFIER_POINTER (PROTOCOL_NAME (p)));
}
return 1;
}
else
{
/* Obscure case - a comparison between two objects
of type 'id <Protocol>'. Check that either the
protocol on the lhs is supported by the object on
the rhs, or viceversa. */
/* Check if the protocol on the lhs is supported by the
object on the rhs. */
for (lproto = lproto_list; lproto;
lproto = TREE_CHAIN (lproto))
{
p = TREE_VALUE (lproto);
rproto = lookup_protocol_in_reflist (rproto_list, p);
if (!rproto)
{
/* Check failed - check if the protocol on the rhs
is supported by the object on the lhs. */
for (rproto = rproto_list; rproto;
rproto = TREE_CHAIN (rproto))
{
p = TREE_VALUE (rproto);
lproto = lookup_protocol_in_reflist (lproto_list,
p);
if (!lproto)
{
/* This check failed too: incompatible */
return 0;
}
}
return 1;
}
}
return 1;
}
}
/* <Protocol> = <class> * */
else if (TYPED_OBJECT (TREE_TYPE (rhs)))
{
tree rname = OBJC_TYPE_NAME (TREE_TYPE (rhs));
tree rinter;
/* Make sure the protocol is supported by the object on
the rhs. */
for (lproto = lproto_list; lproto; lproto = TREE_CHAIN (lproto))
{
p = TREE_VALUE (lproto);
rproto = 0;
rinter = lookup_interface (rname);
while (rinter && !rproto)
{
tree cat;
rproto_list = CLASS_PROTOCOL_LIST (rinter);
rproto = lookup_protocol_in_reflist (rproto_list, p);
/* If the underlying ObjC class does not have
the protocol we're looking for, check for "one-off"
protocols (e.g., `NSObject<MyProt> *foo;') attached
to the rhs. */
if (!rproto)
{
rproto_list = TYPE_PROTOCOL_LIST (TREE_TYPE (rhs));
rproto = lookup_protocol_in_reflist (rproto_list, p);
}
1996-07-04 00:07:53 +02:00
/* Check for protocols adopted by categories. */
cat = CLASS_CATEGORY_LIST (rinter);
while (cat && !rproto)
{
rproto_list = CLASS_PROTOCOL_LIST (cat);
rproto = lookup_protocol_in_reflist (rproto_list, p);
cat = CLASS_CATEGORY_LIST (cat);
}
rinter = lookup_interface (CLASS_SUPER_NAME (rinter));
}
if (!rproto)
warning ("class `%s' does not implement the `%s' protocol",
IDENTIFIER_POINTER (OBJC_TYPE_NAME (TREE_TYPE (rhs))),
IDENTIFIER_POINTER (PROTOCOL_NAME (p)));
}
return 1;
}
/* <Protocol> = id */
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 if (objc_is_object_id (TREE_TYPE (rhs)))
{
return 1;
}
/* <Protocol> = 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
else if (objc_is_class_id (TREE_TYPE (rhs)))
{
return 0;
}
/* <Protocol> = ?? : let comptypes decide. */
return -1;
}
else if (rhs_is_proto)
{
/* <class> * = <Protocol> */
if (TYPED_OBJECT (TREE_TYPE (lhs)))
{
if (reflexive)
{
tree rname = OBJC_TYPE_NAME (TREE_TYPE (lhs));
tree rinter;
tree rproto, rproto_list = TYPE_PROTOCOL_LIST (rhs);
/* Make sure the protocol is supported by the object on
the lhs. */
for (rproto = rproto_list; rproto;
rproto = TREE_CHAIN (rproto))
{
tree p = TREE_VALUE (rproto);
tree lproto = 0;
rinter = lookup_interface (rname);
while (rinter && !lproto)
{
tree cat;
tree lproto_list = CLASS_PROTOCOL_LIST (rinter);
lproto = lookup_protocol_in_reflist (lproto_list, p);
/* If the underlying ObjC class does not
have the protocol we're looking for,
check for "one-off" protocols (e.g.,
`NSObject<MyProt> *foo;') attached to the
lhs. */
if (!lproto)
{
lproto_list = TYPE_PROTOCOL_LIST
(TREE_TYPE (lhs));
lproto = lookup_protocol_in_reflist
(lproto_list, p);
}
/* Check for protocols adopted by categories. */
cat = CLASS_CATEGORY_LIST (rinter);
while (cat && !lproto)
{
lproto_list = CLASS_PROTOCOL_LIST (cat);
lproto = lookup_protocol_in_reflist (lproto_list,
p);
cat = CLASS_CATEGORY_LIST (cat);
}
rinter = lookup_interface (CLASS_SUPER_NAME
(rinter));
}
if (!lproto)
warning ("class `%s' does not implement the `%s' protocol",
IDENTIFIER_POINTER (OBJC_TYPE_NAME
(TREE_TYPE (lhs))),
IDENTIFIER_POINTER (PROTOCOL_NAME (p)));
}
return 1;
}
else
return 0;
}
/* id = <Protocol> */
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 if (objc_is_object_id (TREE_TYPE (lhs)))
{
return 1;
}
/* Class = <Protocol> */
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 if (objc_is_class_id (TREE_TYPE (lhs)))
{
return 0;
}
/* ??? = <Protocol> : let comptypes decide */
else
{
return -1;
}
}
else
{
/* Attention: we shouldn't defer to comptypes here. One bad
side effect would be that we might loose the REFLEXIVE
information.
*/
lhs = TREE_TYPE (lhs);
rhs = TREE_TYPE (rhs);
}
}
if (TREE_CODE (lhs) != RECORD_TYPE || TREE_CODE (rhs) != RECORD_TYPE)
{
/* Nothing to do with ObjC - let immediately comptypes take
responsibility for checking. */
return -1;
}
1992-01-18 00:15:38 +01:00
/* `id' = `<class> *' `<class> *' = `id': always allow it.
Please note that
'Object *o = [[Object alloc] init]; falls
in the case <class> * = `id'.
*/
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 ((objc_is_object_id (lhs) && TYPED_OBJECT (rhs))
|| (objc_is_object_id (rhs) && TYPED_OBJECT (lhs)))
1992-01-18 00:15:38 +01:00
return 1;
/* `id' = `Class', `Class' = `id' */
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 if ((objc_is_object_id (lhs) && objc_is_class_id (rhs))
|| (objc_is_class_id (lhs) && objc_is_object_id (rhs)))
1992-01-18 00:15:38 +01:00
return 1;
/* `Class' != `<class> *' && `<class> *' != `Class'! */
else if ((OBJC_TYPE_NAME (lhs) == objc_class_id && TYPED_OBJECT (rhs))
|| (OBJC_TYPE_NAME (rhs) == objc_class_id && TYPED_OBJECT (lhs)))
return 0;
1992-01-18 00:15:38 +01:00
/* `<class> *' = `<class> *' */
else if (TYPED_OBJECT (lhs) && TYPED_OBJECT (rhs))
{
tree lname = OBJC_TYPE_NAME (lhs);
tree rname = OBJC_TYPE_NAME (rhs);
tree inter;
1992-01-18 00:15:38 +01:00
if (lname == rname)
return 1;
/* If the left hand side is a super class of the right hand side,
allow it. */
for (inter = lookup_interface (rname); inter;
inter = lookup_interface (CLASS_SUPER_NAME (inter)))
if (lname == CLASS_SUPER_NAME (inter))
return 1;
/* Allow the reverse when reflexive. */
if (reflexive)
for (inter = lookup_interface (lname); inter;
inter = lookup_interface (CLASS_SUPER_NAME (inter)))
if (rname == CLASS_SUPER_NAME (inter))
return 1;
return 0;
1992-01-18 00:15:38 +01:00
}
else
/* Not an ObjC type - let comptypes do the check. */
return -1;
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))))
error ("statically allocated instance of Objective-C class `%s'",
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)
{
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
if (!interface)
type = objc_object_type;
else if (!(type = objc_is_id (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
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
/* Look up protocols and install in lang specific list. Note
that the protocol list can have a different lifetime than T! */
SET_TYPE_PROTOCOL_LIST (type, lookup_and_install_protocols (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
/* Establish the ObjC-ness of this record. */
if (TREE_CODE (type) == RECORD_TYPE)
TREE_STATIC_TEMPLATE (type) = 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 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)
fatal_error ("protocol `%s' 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)
error ("cannot find protocol declaration for `%s'",
IDENTIFIER_POINTER (ident));
else
return_value = chainon (return_value,
build_tree_list (NULL_TREE, p));
}
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 refernce. This is only
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);
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)));
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)));
umsg_decl = builtin_function (TAG_MSGSEND,
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
umsg_nonnil_decl = builtin_function (TAG_MSGSEND_NONNIL,
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
umsg_stret_decl = builtin_function (TAG_MSGSEND_STRET,
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
umsg_nonnil_stret_decl = builtin_function (TAG_MSGSEND_NONNIL_STRET,
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
/* 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)));
umsg_super_decl = builtin_function (TAG_MSGSENDSUPER,
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
umsg_super_stret_decl = builtin_function (TAG_MSGSENDSUPER_STRET,
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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, 0, NOT_BUILT_IN, 0,
NULL_TREE);
}
else
{
/* GNU runtime messenger entry points. */
/* typedef id (*IMP)(id, SEL, ...); */
tree IMP_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
(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)));
umsg_decl = builtin_function (TAG_MSGSEND,
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
/* 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)));
umsg_super_decl = builtin_function (TAG_MSGSENDSUPER,
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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, 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
/* 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));
execclass_decl = 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
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
= 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
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
= 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");
#ifndef OBJCPLUS
/* The C++ front-end does not appear to grok __attribute__((__unused__)). */
unused_list = build_tree_list (get_identifier ("__unused__"), 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
#endif
#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 = TYPE_FIELDS (constant_string_type);
#define AT_LEAST_AS_LARGE_AS(F, T) \
(F && TREE_CODE (F) == FIELD_DECL \
&& (TREE_INT_CST_LOW (DECL_SIZE (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;
/* 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));
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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);
if (!constant_string_class
|| !(constant_string_type
= CLASS_STATIC_TEMPLATE (constant_string_class)))
error ("cannot find interface declaration for `%s'",
IDENTIFIER_POINTER (constant_string_id));
/* The NSConstantString/NXConstantString ivar layout is now known. */
else if (!check_string_class_template ())
error ("interface `%s' does not have valid constant string layout",
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 ())
error ("cannot find reference tag for class `%s'",
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)
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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) { NULL, string, length }) */
/* NeXT: & ((NSConstantString) { isa, string, length }) */
fields = TYPE_FIELDS (constant_string_type);
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 (constant_string_type,
nreverse (initlist));
TREE_INVARIANT (constructor) = true;
if (!flag_next_runtime)
constructor
= objc_add_static_instance (constructor, constant_string_type);
desc->constructor = 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
addr = build_unary_op (ADDR_EXPR, desc->constructor, 1);
TREE_CONSTANT (addr) = true;
TREE_INVARIANT (addr) = true;
TREE_STATIC (addr) = true;
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;
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)
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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 constructor = build_constructor (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, ... } */
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));
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, ... } */
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, 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 = size_in_bytes (objc_module_template);
initlist = tree_cons (NULL_TREE, expr, initlist);
1992-01-18 00:15:38 +01:00
/* name = { ..., "foo.m", ... } */
expr = add_objc_string (get_identifier (input_filename), 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
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);
}
1996-07-04 00:07:53 +02:00
/* Output all strings. */
1992-01-18 00:15:38 +01:00
static void
generate_strings (void)
1992-01-18 00:15:38 +01:00
{
tree chain, string_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 string, decl, type;
1992-01-18 00:15:38 +01:00
for (chain = class_names_chain; chain; chain = TREE_CHAIN (chain))
1992-01-18 00:15:38 +01:00
{
string = TREE_VALUE (chain);
decl = TREE_PURPOSE (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
type = build_array_type
(char_type_node,
build_index_type
(build_int_cst (NULL_TREE,
IDENTIFIER_LENGTH (string))));
decl = start_var_decl (type, IDENTIFIER_POINTER (DECL_NAME (decl)));
string_expr = my_build_string (IDENTIFIER_LENGTH (string) + 1,
IDENTIFIER_POINTER (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
finish_var_decl (decl, string_expr);
1992-01-18 00:15:38 +01:00
}
for (chain = meth_var_names_chain; chain; chain = TREE_CHAIN (chain))
{
string = TREE_VALUE (chain);
decl = TREE_PURPOSE (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
type = build_array_type
(char_type_node,
build_index_type
(build_int_cst (NULL_TREE,
IDENTIFIER_LENGTH (string))));
decl = start_var_decl (type, IDENTIFIER_POINTER (DECL_NAME (decl)));
string_expr = my_build_string (IDENTIFIER_LENGTH (string) + 1,
IDENTIFIER_POINTER (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
finish_var_decl (decl, string_expr);
}
1992-01-18 00:15:38 +01:00
for (chain = meth_var_types_chain; chain; chain = TREE_CHAIN (chain))
{
string = TREE_VALUE (chain);
decl = TREE_PURPOSE (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
type = build_array_type
(char_type_node,
build_index_type
(build_int_cst (NULL_TREE,
IDENTIFIER_LENGTH (string))));
decl = start_var_decl (type, IDENTIFIER_POINTER (DECL_NAME (decl)));
string_expr = my_build_string (IDENTIFIER_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
IDENTIFIER_POINTER (string));
finish_var_decl (decl, string_expr);
}
1992-01-18 00:15:38 +01:00
}
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)
{
/* Adjust line number for warning message. */
int save_lineno = input_line;
if (flag_next_runtime && TREE_PURPOSE (chain))
input_line = DECL_SOURCE_LINE (TREE_PURPOSE (chain));
warning ("creating selector for non existant method %s",
IDENTIFIER_POINTER (TREE_VALUE (chain)));
input_line = save_lineno;
}
}
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),
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
{
tree orig_ident;
#ifdef OBJCPLUS
if (processing_template_decl)
/* Must wait until template instantiation time. */
return build_min_nt (CLASS_REFERENCE_EXPR, ident);
if (TREE_CODE (ident) == TYPE_DECL)
ident = DECL_NAME (ident);
#endif
orig_ident = ident;
if (!(ident = objc_is_class_name (ident)))
{
error ("`%s' 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,
my_build_string (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;
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);
*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)))
c-decl.c (duplicate_decls, [...]): Remove leading capital from diagnostics. * c-decl.c (duplicate_decls, push_parm_decl): Remove leading capital from diagnostics. * c-lex.c (cb_file_change): Similarly. * c-parse.in : Similarly. * cfgrtl.c (verify_flow_info): Similarly. * collect2.c: Similarly. * cppfiles.c (find_include_file): Similarly. * cppinit.c (cpp_handle_option): Similarly. * cpplex.c (cpp_spell_token): Similarly. * cppmain.c (do_preprocessing): Similarly. * gcc.c (translate_options, process_command, do_spec1, main, pfatal_execute): Similarly. * genattr.c (main): Similarly. * genattrtab.c (check_attr_test, operate_exp, simplify_test_exp, write_test_expr, main): Similarly. * gencodes.c (main): Similarly. * genconfig.c (main): Similarly. * genconstants.c (main): Similarly. * genemit.c (main): Similarly. * genextract.c (main): Similarly. * genflags.c (main): Similarly. * genopinit.c (main): Similarly. * genoutput.c (process_template, main): Similarly. * genpeep.c (main): Similarly. * genrecog.c (main): Similarly. * gensupport.c (is_predicable, identify_predicable_attribute, alter_predicate_for_insn, init_md_reader_args, main): Similarly. * ggc-page.c (alloc_anon): Similarly. * mips-tfile.c (add_string, add_procedure, add_file, read_line, parse_begin, parse_bend, parse_def, parse_end, parse_file, parse_stabs_common, parse_stabs, write_varray, write_object, read_seek, copy_object, main, error): Similarly. * profile.c (compute_branch_probabilities): Similarly. * reg-stack.c (check_asm_stack_operands): Similarly. * reload.c (find_reloads): Similarly. * reload1.c (spill_failure, failed_reload): Similarly. * rtl-error.c (_fatal_insn_not_found): Similarly. * toplev.c (read_integral_parameter, crash_signal, decode_f_option, set_target_switch, parse_options_and_default_flags) : Similarly. * tradcif.y (parse_number, yylex): Similarly. * tradcpp.c (main, fancy_abort): Similarly. * tree.c (tree_check_failed): Similarly. * varray.c (varray_check_failed): Similarly. * xcoffout.c (xcoff_output_standard_types): Similarly. cp: * call.c (build_java_interface_fn_ref): Similarly. * except.c (is_admissible_throw_operand): Similarly. * init.c (build_java_class_ref): Similarly. * xref.c (open_xref_file): Similarly. objc: * objc-act.c (get_object_ref, lookup_and_install_protocols, build_objc_string_object, objc_declare_alias, build_ivar_chain, finish_message_expr, build_protocol_expr, is_public, start_class): Similarly. testsuite: * objc.dg/alias.m: Update. * objc.dg/class-1.m: Update. * objc.dg/const-str-1.m: Update. * objc.dg/fwd-proto-1.m: Update. * objc.dg/id-1.m: Update. * objc.dg/super-class-1.m: Update. From-SVN: r47518
2001-12-02 01:04:36 +01:00
warning ("cannot find class `%s'", IDENTIFIER_POINTER (class_ident));
else if (objc_is_class_name (alias_ident))
c-decl.c (duplicate_decls, [...]): Remove leading capital from diagnostics. * c-decl.c (duplicate_decls, push_parm_decl): Remove leading capital from diagnostics. * c-lex.c (cb_file_change): Similarly. * c-parse.in : Similarly. * cfgrtl.c (verify_flow_info): Similarly. * collect2.c: Similarly. * cppfiles.c (find_include_file): Similarly. * cppinit.c (cpp_handle_option): Similarly. * cpplex.c (cpp_spell_token): Similarly. * cppmain.c (do_preprocessing): Similarly. * gcc.c (translate_options, process_command, do_spec1, main, pfatal_execute): Similarly. * genattr.c (main): Similarly. * genattrtab.c (check_attr_test, operate_exp, simplify_test_exp, write_test_expr, main): Similarly. * gencodes.c (main): Similarly. * genconfig.c (main): Similarly. * genconstants.c (main): Similarly. * genemit.c (main): Similarly. * genextract.c (main): Similarly. * genflags.c (main): Similarly. * genopinit.c (main): Similarly. * genoutput.c (process_template, main): Similarly. * genpeep.c (main): Similarly. * genrecog.c (main): Similarly. * gensupport.c (is_predicable, identify_predicable_attribute, alter_predicate_for_insn, init_md_reader_args, main): Similarly. * ggc-page.c (alloc_anon): Similarly. * mips-tfile.c (add_string, add_procedure, add_file, read_line, parse_begin, parse_bend, parse_def, parse_end, parse_file, parse_stabs_common, parse_stabs, write_varray, write_object, read_seek, copy_object, main, error): Similarly. * profile.c (compute_branch_probabilities): Similarly. * reg-stack.c (check_asm_stack_operands): Similarly. * reload.c (find_reloads): Similarly. * reload1.c (spill_failure, failed_reload): Similarly. * rtl-error.c (_fatal_insn_not_found): Similarly. * toplev.c (read_integral_parameter, crash_signal, decode_f_option, set_target_switch, parse_options_and_default_flags) : Similarly. * tradcif.y (parse_number, yylex): Similarly. * tradcpp.c (main, fancy_abort): Similarly. * tree.c (tree_check_failed): Similarly. * varray.c (varray_check_failed): Similarly. * xcoffout.c (xcoff_output_standard_types): Similarly. cp: * call.c (build_java_interface_fn_ref): Similarly. * except.c (is_admissible_throw_operand): Similarly. * init.c (build_java_class_ref): Similarly. * xref.c (open_xref_file): Similarly. objc: * objc-act.c (get_object_ref, lookup_and_install_protocols, build_objc_string_object, objc_declare_alias, build_ivar_chain, finish_message_expr, build_protocol_expr, is_public, start_class): Similarly. testsuite: * objc.dg/alias.m: Update. * objc.dg/class-1.m: Update. * objc.dg/const-str-1.m: Update. * objc.dg/fwd-proto-1.m: Update. * objc.dg/id-1.m: Update. * objc.dg/super-class-1.m: Update. From-SVN: r47518
2001-12-02 01:04:36 +01:00
warning ("class `%s' already exists", IDENTIFIER_POINTER (alias_ident));
1992-01-18 00:15:38 +01:00
else
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))
{
tree record = lookup_name (ident);
if (record && ! TREE_STATIC_TEMPLATE (record))
{
error ("`%s' redeclared as different kind of symbol",
IDENTIFIER_POINTER (ident));
error ("%Jprevious declaration of '%D'",
record, record);
}
record = xref_tag (RECORD_TYPE, ident);
TREE_STATIC_TEMPLATE (record) = 1;
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. */
return (objc_object_type && type && (IS_ID (type) || IS_CLASS (type))
? type
: NULL_TREE);
}
/* 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
}
static tree
lookup_interface (tree ident)
1992-01-18 00:15:38 +01:00
{
tree chain;
#ifdef OBJCPLUS
if (ident && TREE_CODE (ident) == TYPE_DECL)
ident = DECL_NAME (ident);
#endif
1992-01-18 00:15:38 +01:00
for (chain = interface_chain; chain; chain = TREE_CHAIN (chain))
{
if (ident == CLASS_NAME (chain))
return chain;
1992-01-18 00:15:38 +01:00
}
return NULL_TREE;
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)
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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 get_class_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
error ("cannot find interface declaration for `%s'",
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
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
get_class_ivars (tree 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
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;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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)
warning ("use %<-fobjc-exceptions%> to enable Objective-C "
"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");
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
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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 (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);
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_component_ref (cur_try_context->stack_decl,
get_identifier ("buf"));
t = build_fold_addr_expr (t);
t = convert (ptr_type_node, t);
t = tree_cons (NULL, t, NULL);
sj = build_function_call (objc_setjmp_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
cond = build (COMPOUND_EXPR, TREE_TYPE (sj), enter, sj);
cond = lang_hooks.truthvalue_conversion (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
return build (COND_EXPR, void_type_node, cond, NULL, 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
/* Build
DECL = objc_exception_extract(&_stack);
*/
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 = build (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 = lang_hooks.truthvalue_conversion (t);
}
t = build (COND_EXPR, void_type_node, cond, body, NULL);
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)
{
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 (MODIFY_EXPR, void_type_node, cur_try_context->rethrow_decl,
cur_try_context->caught_decl);
annotate_with_locus (t, cur_try_context->end_catch_locus);
append_to_statement_list (t, last);
t = next_sjlj_build_try_exit ();
annotate_with_locus (t, cur_try_context->end_catch_locus);
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 varible binding level. */
bind = build (BIND_EXPR, void_type_node, rethrow_decl, NULL, NULL);
annotate_with_locus (bind, cur_try_context->try_locus);
TREE_SIDE_EFFECTS (bind) = 1;
/* Initialize rethrow_decl. */
t = build (MODIFY_EXPR, void_type_node, rethrow_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
convert (objc_object_type, null_pointer_node));
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
annotate_with_locus (t, cur_try_context->try_locus);
append_to_statement_list (t, &BIND_EXPR_BODY (bind));
/* Build the outermost TRY_FINALLY_EXPR. */
try_fin = build (TRY_FINALLY_EXPR, void_type_node, NULL, NULL);
annotate_with_locus (try_fin, cur_try_context->try_locus);
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);
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);
annotate_with_locus (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 ();
annotate_with_locus (t, cur_try_context->try_locus);
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,
lang_hooks.truthvalue_conversion (rethrow_decl),
NULL, t);
annotate_with_locus (t, cur_try_context->finally_locus);
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,
lang_hooks.truthvalue_conversion (rethrow_decl),
t, NULL);
annotate_with_locus (t, cur_try_context->end_finally_locus);
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 ();
}
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 "@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. */
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;
if (!t || objc_comptypes (TREE_TYPE (t), TREE_TYPE (type), 0) == 1)
{
warning ("exception of type %<%T%> will be caught",
TREE_TYPE (type));
warning ("%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 = build (MODIFY_EXPR, void_type_node, decl, t);
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. */
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_try_stmt (void)
{
struct objc_try_context *c = cur_try_context;
tree stmt;
if (c->catch_list == NULL && c->finally_body == NULL)
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);
annotate_with_locus (stmt, cur_try_context->try_locus);
}
if (c->finally_body)
{
stmt = build_stmt (TRY_FINALLY_EXPR, stmt, c->finally_body);
annotate_with_locus (stmt, cur_try_context->try_locus);
}
}
add_stmt (stmt);
cur_try_context = c->outer;
free (c);
}
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));
}
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_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);
annotate_with_locus (call, start_locus);
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);
annotate_with_locus (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);
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[_JBLEN];
void *pointers[4];
}; */
/* The following yuckiness should prevent users from having to #include
<setjmp.h> in their code... */
#ifdef TARGET_POWERPC
/* snarfed from /usr/include/ppc/setjmp.h */
#define _JBLEN (26 + 36 + 129 + 1)
#else
/* snarfed from /usr/include/i386/{setjmp,signal}.h */
#define _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[_JBLEN]; */
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, _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
= 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
= 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
= builtin_function (TAG_EXCEPTIONTRYENTER, temp_type, 0, NOT_BUILT_IN, NULL, NULL_TREE);
objc_exception_try_exit_decl
= 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); */
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
temp_type
= 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
= builtin_function (TAG_EXCEPTIONMATCH, 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
= builtin_function (TAG_EXCEPTIONTHROW, temp_type, 0, NOT_BUILT_IN, NULL,
noreturn_list);
objc_sync_enter_decl
= builtin_function (TAG_SYNCENTER, temp_type, 0, NOT_BUILT_IN,
NULL, nothrow_list);
objc_sync_exit_decl
= builtin_function (TAG_SYNCEXIT, temp_type, 0, NOT_BUILT_IN,
NULL, nothrow_list);
}
/* 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;
...
}; */
static tree
build_private_template (tree class)
{
tree ivar_context;
if (CLASS_STATIC_TEMPLATE (class))
{
uprivate_record = CLASS_STATIC_TEMPLATE (class);
ivar_context = TYPE_FIELDS (CLASS_STATIC_TEMPLATE (class));
}
else
{
uprivate_record = start_struct (RECORD_TYPE, CLASS_NAME (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
ivar_context = get_class_ivars (class);
finish_struct (uprivate_record, ivar_context, NULL_TREE);
CLASS_STATIC_TEMPLATE (class) = uprivate_record;
/* mark this record as class template - for class type checking */
TREE_STATIC_TEMPLATE (uprivate_record) = 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
objc_instance_type = build_pointer_type (uprivate_record);
return ivar_context;
}
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);
/* struct objc_method_list *instance_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
field_decl = create_field_decl (build_pointer_type
(xref_tag (RECORD_TYPE,
get_identifier
(UTAG_METHOD_PROTOTYPE_LIST))),
"instance_methods");
chainon (field_decl_chain, field_decl);
/* struct objc_method_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
field_decl = create_field_decl (build_pointer_type
(xref_tag (RECORD_TYPE,
get_identifier
(UTAG_METHOD_PROTOTYPE_LIST))),
"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);
return TYPE_MAIN_VARIANT (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)
{
error ("%Jtype '%D' does not have a known size",
type, 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;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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 variable_length_type
= xref_tag (RECORD_TYPE,
get_identifier (UTAG_METHOD_PROTOTYPE_LIST));
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);
TREE_TYPE (UOBJC_CLASS_METHODS_decl) = variable_length_type;
}
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);
TREE_TYPE (UOBJC_INSTANCE_METHODS_decl) = variable_length_type;
}
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
}
/* 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 inizialization.
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
{
expr = 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
{
expr = 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; */
field_decl = create_field_decl (build_pointer_type
(xref_tag (RECORD_TYPE,
get_identifier
(UTAG_METHOD_LIST))),
"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; */
field_decl = create_field_decl (build_pointer_type
(xref_tag (RECORD_TYPE,
get_identifier
(UTAG_METHOD_LIST))),
"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; */
field_decl = create_field_decl (build_pointer_type
(xref_tag (RECORD_TYPE,
get_identifier
(UTAG_IVAR_LIST))),
"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; */
field_decl = create_field_decl (build_pointer_type
(xref_tag (RECORD_TYPE,
get_identifier
(UTAG_METHOD_LIST))),
"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");
ucls_super_ref = build_component_ref (UOBJC_CLASS_decl, an_id);
uucls_super_ref = 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
{
error ("%J%s `%s'", 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; */
field_decl = create_field_decl (build_pointer_type
(xref_tag (RECORD_TYPE,
get_identifier
(UTAG_METHOD_PROTOTYPE_LIST))),
"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. */
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;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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 variable_length_type
= xref_tag (RECORD_TYPE, get_identifier (UTAG_IVAR_LIST));
1992-01-18 00:15:38 +01:00
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);
TREE_TYPE (UOBJC_CLASS_VARIABLES_decl) = variable_length_type;
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);
TREE_TYPE (UOBJC_INSTANCE_VARIABLES_decl) = variable_length_type;
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,
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;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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 variable_length_type
= xref_tag (RECORD_TYPE, get_identifier (UTAG_METHOD_LIST));
1992-01-18 00:15:38 +01:00
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);
TREE_TYPE (UOBJC_CLASS_METHODS_decl) = variable_length_type;
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);
TREE_TYPE (UOBJC_INSTANCE_METHODS_decl) = variable_length_type;
1992-01-18 00:15:38 +01:00
}
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
{
expr = 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
{
expr = 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
(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 = */
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
/* 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 = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, status), initlist);
1992-01-18 00:15:38 +01:00
/* instance_size = */
initlist = tree_cons (NULL_TREE, 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
{
expr = 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
{
expr = 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
(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
generate_shared_structures (void)
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))),
1 /*CLS_FACTORY*/,
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)
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;
}
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));
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 (!TREE_OVERFLOW (METHOD_ADD_ARGS (meth)))
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;
warning ("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
&& (exp = TREE_OPERAND (receiver, 0))
&& 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! */
&& (arg = TREE_OPERAND (receiver, 1))
&& TREE_CODE (arg) == TREE_LIST
&& (arg = TREE_VALUE (arg)))
{
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)));
/* 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))
{
error ("no super class declared in @interface for `%s'",
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. */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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 (!rtype || objc_is_id (rtype))
1992-01-18 00:15:38 +01:00
{
if (!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
rtype = xref_tag (RECORD_TYPE, class_tree);
else if (IS_ID (rtype))
1992-01-18 00:15:38 +01:00
{
rprotos = TYPE_PROTOCOL_LIST (rtype);
rtype = NULL_TREE;
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
{
class_tree = objc_class_name;
OBJC_SET_TYPE_NAME (rtype, class_tree);
}
if (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);
if (!method_prototype && !rprotos)
method_prototype
= lookup_method_in_hash_lists (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
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
{
rprotos = TYPE_PROTOCOL_LIST (rtype);
rtype = lookup_interface (OBJC_TYPE_NAME (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. */
if (!rtype)
rtype = saved_rtype;
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
{
warning ("invalid receiver type `%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
gen_type_name (orig_rtype));
rtype = rprotos = NULL_TREE;
1992-01-18 00:15:38 +01:00
}
}
if (!method_prototype)
1992-01-18 00:15:38 +01:00
{
static bool warn_missing_methods = false;
if (rtype)
warning ("`%s' 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));
if (rprotos)
warning ("`%c%s' not implemented by protocol(s)",
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));
if (!warn_missing_methods)
1992-01-18 00:15:38 +01:00
{
warning ("(Messages without a matching method signature");
warning ("will be assumed to return `id' and accept");
warning ("`...' 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
? 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 = build (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)
{
c-decl.c (duplicate_decls, [...]): Remove leading capital from diagnostics. * c-decl.c (duplicate_decls, push_parm_decl): Remove leading capital from diagnostics. * c-lex.c (cb_file_change): Similarly. * c-parse.in : Similarly. * cfgrtl.c (verify_flow_info): Similarly. * collect2.c: Similarly. * cppfiles.c (find_include_file): Similarly. * cppinit.c (cpp_handle_option): Similarly. * cpplex.c (cpp_spell_token): Similarly. * cppmain.c (do_preprocessing): Similarly. * gcc.c (translate_options, process_command, do_spec1, main, pfatal_execute): Similarly. * genattr.c (main): Similarly. * genattrtab.c (check_attr_test, operate_exp, simplify_test_exp, write_test_expr, main): Similarly. * gencodes.c (main): Similarly. * genconfig.c (main): Similarly. * genconstants.c (main): Similarly. * genemit.c (main): Similarly. * genextract.c (main): Similarly. * genflags.c (main): Similarly. * genopinit.c (main): Similarly. * genoutput.c (process_template, main): Similarly. * genpeep.c (main): Similarly. * genrecog.c (main): Similarly. * gensupport.c (is_predicable, identify_predicable_attribute, alter_predicate_for_insn, init_md_reader_args, main): Similarly. * ggc-page.c (alloc_anon): Similarly. * mips-tfile.c (add_string, add_procedure, add_file, read_line, parse_begin, parse_bend, parse_def, parse_end, parse_file, parse_stabs_common, parse_stabs, write_varray, write_object, read_seek, copy_object, main, error): Similarly. * profile.c (compute_branch_probabilities): Similarly. * reg-stack.c (check_asm_stack_operands): Similarly. * reload.c (find_reloads): Similarly. * reload1.c (spill_failure, failed_reload): Similarly. * rtl-error.c (_fatal_insn_not_found): Similarly. * toplev.c (read_integral_parameter, crash_signal, decode_f_option, set_target_switch, parse_options_and_default_flags) : Similarly. * tradcif.y (parse_number, yylex): Similarly. * tradcpp.c (main, fancy_abort): Similarly. * tree.c (tree_check_failed): Similarly. * varray.c (varray_check_failed): Similarly. * xcoffout.c (xcoff_output_standard_types): Similarly. cp: * call.c (build_java_interface_fn_ref): Similarly. * except.c (is_admissible_throw_operand): Similarly. * init.c (build_java_class_ref): Similarly. * xref.c (open_xref_file): Similarly. objc: * objc-act.c (get_object_ref, lookup_and_install_protocols, build_objc_string_object, objc_declare_alias, build_ivar_chain, finish_message_expr, build_protocol_expr, is_public, start_class): Similarly. testsuite: * objc.dg/alias.m: Update. * objc.dg/class-1.m: Update. * objc.dg/const-str-1.m: Update. * objc.dg/fwd-proto-1.m: Update. * objc.dg/id-1.m: Update. * objc.dg/super-class-1.m: Update. From-SVN: r47518
2001-12-02 01:04:36 +01:00
error ("cannot find protocol declaration for `%s'",
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)
{
warning ("undeclared selector `%s'", 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. */
warning ("instance variable `%s' 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
return build_component_ref (build_indirect_ref (self_decl, "->"), id);
}
/* 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);
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
}
static tree
lookup_method_static (tree interface, tree ident, int is_class)
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;
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;
}
/* 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. */
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;
int already_there = comp_proto_with_proto (method, hsh->key);
for (loop = hsh->list; !already_there && loop; loop = loop->next)
already_there |= comp_proto_with_proto (method, loop->value);
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)
&& !comp_proto_with_proto (method, mth))
error ("duplicate declaration of method `%c%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
is_class ? '+' : '-',
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)
may acts as class methods as a last resort. */
if (TREE_CODE (class) == CATEGORY_INTERFACE_TYPE
|| TREE_CODE (class) == CATEGORY_IMPLEMENTATION_TYPE)
class = lookup_interface (CLASS_NAME (class));
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
add_class (tree class)
1992-01-18 00:15:38 +01:00
{
1996-07-04 00:07:53 +02:00
/* Put interfaces on list in reverse order. */
1992-01-18 00:15:38 +01:00
TREE_CHAIN (class) = interface_chain;
interface_chain = class;
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)
{
warning ("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)
{
error ("illegal reference type specified for instance variable `%s'",
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! */
{
error ("instance variable `%s' has unknown size", ivar_name);
/* Return class as is without adding this ivar. */
return class;
}
#ifdef OBJCPLUS
/* zlaski 2001-Apr-24: C++ classes with non-trivial constructors and/or destructors
cannot be ivars; ditto for classes with vtables. */
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));
if(TYPE_POLYMORPHIC_P (field_type)) {
/* vtable pointers are Real Bad(tm), since Obj-C cannot initialize them */
error ("type `%s' has virtual member functions", type_name);
error ("illegal aggregate type `%s' specified for instance variable `%s'",
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 ("type `%s' has a user-defined constructor", type_name);
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (field_type))
warning ("type `%s' has a user-defined destructor", type_name);
warning ("C++ constructors and destructors will not be invoked for Objective-C fields");
}
#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
{
tree basetype = TREE_TYPE (expr);
enum tree_code code = TREE_CODE (basetype);
tree decl;
if (code == RECORD_TYPE)
{
if (TREE_STATIC_TEMPLATE (basetype))
{
if (!lookup_interface (OBJC_TYPE_NAME (basetype)))
1992-01-18 00:15:38 +01:00
{
c-decl.c (duplicate_decls, [...]): Remove leading capital from diagnostics. * c-decl.c (duplicate_decls, push_parm_decl): Remove leading capital from diagnostics. * c-lex.c (cb_file_change): Similarly. * c-parse.in : Similarly. * cfgrtl.c (verify_flow_info): Similarly. * collect2.c: Similarly. * cppfiles.c (find_include_file): Similarly. * cppinit.c (cpp_handle_option): Similarly. * cpplex.c (cpp_spell_token): Similarly. * cppmain.c (do_preprocessing): Similarly. * gcc.c (translate_options, process_command, do_spec1, main, pfatal_execute): Similarly. * genattr.c (main): Similarly. * genattrtab.c (check_attr_test, operate_exp, simplify_test_exp, write_test_expr, main): Similarly. * gencodes.c (main): Similarly. * genconfig.c (main): Similarly. * genconstants.c (main): Similarly. * genemit.c (main): Similarly. * genextract.c (main): Similarly. * genflags.c (main): Similarly. * genopinit.c (main): Similarly. * genoutput.c (process_template, main): Similarly. * genpeep.c (main): Similarly. * genrecog.c (main): Similarly. * gensupport.c (is_predicable, identify_predicable_attribute, alter_predicate_for_insn, init_md_reader_args, main): Similarly. * ggc-page.c (alloc_anon): Similarly. * mips-tfile.c (add_string, add_procedure, add_file, read_line, parse_begin, parse_bend, parse_def, parse_end, parse_file, parse_stabs_common, parse_stabs, write_varray, write_object, read_seek, copy_object, main, error): Similarly. * profile.c (compute_branch_probabilities): Similarly. * reg-stack.c (check_asm_stack_operands): Similarly. * reload.c (find_reloads): Similarly. * reload1.c (spill_failure, failed_reload): Similarly. * rtl-error.c (_fatal_insn_not_found): Similarly. * toplev.c (read_integral_parameter, crash_signal, decode_f_option, set_target_switch, parse_options_and_default_flags) : Similarly. * tradcif.y (parse_number, yylex): Similarly. * tradcpp.c (main, fancy_abort): Similarly. * tree.c (tree_check_failed): Similarly. * varray.c (varray_check_failed): Similarly. * xcoffout.c (xcoff_output_standard_types): Similarly. cp: * call.c (build_java_interface_fn_ref): Similarly. * except.c (is_admissible_throw_operand): Similarly. * init.c (build_java_class_ref): Similarly. * xref.c (open_xref_file): Similarly. objc: * objc-act.c (get_object_ref, lookup_and_install_protocols, build_objc_string_object, objc_declare_alias, build_ivar_chain, finish_message_expr, build_protocol_expr, is_public, start_class): Similarly. testsuite: * objc.dg/alias.m: Update. * objc.dg/class-1.m: Update. * objc.dg/const-str-1.m: Update. * objc.dg/fwd-proto-1.m: Update. * objc.dg/id-1.m: Update. * objc.dg/super-class-1.m: Update. From-SVN: r47518
2001-12-02 01:04:36 +01:00
error ("cannot find interface declaration for `%s'",
IDENTIFIER_POINTER (OBJC_TYPE_NAME (basetype)));
return 0;
}
1992-01-18 00:15:38 +01:00
if ((decl = is_ivar (TYPE_FIELDS (basetype), 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
&& (((TREE_CODE (objc_implementation_context)
== CLASS_IMPLEMENTATION_TYPE)
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)
== CATEGORY_IMPLEMENTATION_TYPE))
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)
== OBJC_TYPE_NAME (basetype))))
{
int private = is_private (decl);
if (private)
error ("instance variable `%s' 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)
{
warning ("instance variable `%s' is %s; "
"this will be a hard error in the future",
IDENTIFIER_POINTER (identifier),
TREE_PRIVATE (decl) ? "@private" : "@protected");
return 1;
}
error ("instance variable `%s' is declared %s",
IDENTIFIER_POINTER (identifier),
TREE_PRIVATE (decl) ? "private" : "protected");
1992-01-18 00:15:38 +01:00
return 0;
}
}
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 (objc_implementation_context && (basetype == objc_object_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
expr = convert (uprivate_record, expr);
warning ("static access to object of type `id'");
1992-01-18 00:15:38 +01:00
}
}
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)
1992-01-18 00:15:38 +01:00
warning ("incomplete implementation of class `%s'",
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)
1992-01-18 00:15:38 +01:00
warning ("incomplete implementation of category `%s'",
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;
}
1992-01-18 00:15:38 +01:00
warning ("method definition for `%c%s' not found",
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)
warning ("incomplete implementation of class `%s'",
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)
warning ("incomplete implementation of category `%s'",
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;
}
warning ("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)
warning ("%s `%s' does not fully implement the `%s' 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)
{
warning ("`@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
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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 for existence of the super class, if one was specified. */
if ((code == CLASS_INTERFACE_TYPE || code == CLASS_IMPLEMENTATION_TYPE)
&& super_name && !objc_is_class_name (super_name))
{
error ("cannot find interface declaration for `%s', superclass of `%s'",
IDENTIFIER_POINTER (super_name),
IDENTIFIER_POINTER (class_name));
super_name = NULL_TREE;
}
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)))
{
error ("`%s' redeclared as different kind of symbol",
IDENTIFIER_POINTER (class_name));
error ("%Jprevious declaration of '%D'",
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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, 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)
{
error ("reimplementation of class `%s'",
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)))
{
c-decl.c (duplicate_decls, [...]): Remove leading capital from diagnostics. * c-decl.c (duplicate_decls, push_parm_decl): Remove leading capital from diagnostics. * c-lex.c (cb_file_change): Similarly. * c-parse.in : Similarly. * cfgrtl.c (verify_flow_info): Similarly. * collect2.c: Similarly. * cppfiles.c (find_include_file): Similarly. * cppinit.c (cpp_handle_option): Similarly. * cpplex.c (cpp_spell_token): Similarly. * cppmain.c (do_preprocessing): Similarly. * gcc.c (translate_options, process_command, do_spec1, main, pfatal_execute): Similarly. * genattr.c (main): Similarly. * genattrtab.c (check_attr_test, operate_exp, simplify_test_exp, write_test_expr, main): Similarly. * gencodes.c (main): Similarly. * genconfig.c (main): Similarly. * genconstants.c (main): Similarly. * genemit.c (main): Similarly. * genextract.c (main): Similarly. * genflags.c (main): Similarly. * genopinit.c (main): Similarly. * genoutput.c (process_template, main): Similarly. * genpeep.c (main): Similarly. * genrecog.c (main): Similarly. * gensupport.c (is_predicable, identify_predicable_attribute, alter_predicate_for_insn, init_md_reader_args, main): Similarly. * ggc-page.c (alloc_anon): Similarly. * mips-tfile.c (add_string, add_procedure, add_file, read_line, parse_begin, parse_bend, parse_def, parse_end, parse_file, parse_stabs_common, parse_stabs, write_varray, write_object, read_seek, copy_object, main, error): Similarly. * profile.c (compute_branch_probabilities): Similarly. * reg-stack.c (check_asm_stack_operands): Similarly. * reload.c (find_reloads): Similarly. * reload1.c (spill_failure, failed_reload): Similarly. * rtl-error.c (_fatal_insn_not_found): Similarly. * toplev.c (read_integral_parameter, crash_signal, decode_f_option, set_target_switch, parse_options_and_default_flags) : Similarly. * tradcif.y (parse_number, yylex): Similarly. * tradcpp.c (main, fancy_abort): Similarly. * tree.c (tree_check_failed): Similarly. * varray.c (varray_check_failed): Similarly. * xcoffout.c (xcoff_output_standard_types): Similarly. cp: * call.c (build_java_interface_fn_ref): Similarly. * except.c (is_admissible_throw_operand): Similarly. * init.c (build_java_class_ref): Similarly. * xref.c (open_xref_file): Similarly. objc: * objc-act.c (get_object_ref, lookup_and_install_protocols, build_objc_string_object, objc_declare_alias, build_ivar_chain, finish_message_expr, build_protocol_expr, is_public, start_class): Similarly. testsuite: * objc.dg/alias.m: Update. * objc.dg/class-1.m: Update. * objc.dg/const-str-1.m: Update. * objc.dg/fwd-proto-1.m: Update. * objc.dg/id-1.m: Update. * objc.dg/super-class-1.m: Update. From-SVN: r47518
2001-12-02 01:04:36 +01:00
warning ("cannot find interface declaration for `%s'",
1992-01-18 00:15:38 +01:00
IDENTIFIER_POINTER (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
add_class (implementation_template = objc_implementation_context);
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) : "";
1992-01-18 00:15:38 +01:00
error ("conflicting super class name `%s'",
IDENTIFIER_POINTER (super_name));
error ("previous declaration of `%s'", 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
error ("duplicate interface declaration for class `%s'",
#else
warning ("duplicate interface declaration for class `%s'",
#endif
IDENTIFIER_POINTER (class_name));
1992-01-18 00:15:38 +01:00
else
add_class (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_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)))
{
c-decl.c (duplicate_decls, [...]): Remove leading capital from diagnostics. * c-decl.c (duplicate_decls, push_parm_decl): Remove leading capital from diagnostics. * c-lex.c (cb_file_change): Similarly. * c-parse.in : Similarly. * cfgrtl.c (verify_flow_info): Similarly. * collect2.c: Similarly. * cppfiles.c (find_include_file): Similarly. * cppinit.c (cpp_handle_option): Similarly. * cpplex.c (cpp_spell_token): Similarly. * cppmain.c (do_preprocessing): Similarly. * gcc.c (translate_options, process_command, do_spec1, main, pfatal_execute): Similarly. * genattr.c (main): Similarly. * genattrtab.c (check_attr_test, operate_exp, simplify_test_exp, write_test_expr, main): Similarly. * gencodes.c (main): Similarly. * genconfig.c (main): Similarly. * genconstants.c (main): Similarly. * genemit.c (main): Similarly. * genextract.c (main): Similarly. * genflags.c (main): Similarly. * genopinit.c (main): Similarly. * genoutput.c (process_template, main): Similarly. * genpeep.c (main): Similarly. * genrecog.c (main): Similarly. * gensupport.c (is_predicable, identify_predicable_attribute, alter_predicate_for_insn, init_md_reader_args, main): Similarly. * ggc-page.c (alloc_anon): Similarly. * mips-tfile.c (add_string, add_procedure, add_file, read_line, parse_begin, parse_bend, parse_def, parse_end, parse_file, parse_stabs_common, parse_stabs, write_varray, write_object, read_seek, copy_object, main, error): Similarly. * profile.c (compute_branch_probabilities): Similarly. * reg-stack.c (check_asm_stack_operands): Similarly. * reload.c (find_reloads): Similarly. * reload1.c (spill_failure, failed_reload): Similarly. * rtl-error.c (_fatal_insn_not_found): Similarly. * toplev.c (read_integral_parameter, crash_signal, decode_f_option, set_target_switch, parse_options_and_default_flags) : Similarly. * tradcif.y (parse_number, yylex): Similarly. * tradcpp.c (main, fancy_abort): Similarly. * tree.c (tree_check_failed): Similarly. * varray.c (varray_check_failed): Similarly. * xcoffout.c (xcoff_output_standard_types): Similarly. cp: * call.c (build_java_interface_fn_ref): Similarly. * except.c (is_admissible_throw_operand): Similarly. * init.c (build_java_class_ref): Similarly. * xref.c (open_xref_file): Similarly. objc: * objc-act.c (get_object_ref, lookup_and_install_protocols, build_objc_string_object, objc_declare_alias, build_ivar_chain, finish_message_expr, build_protocol_expr, is_public, start_class): Similarly. testsuite: * objc.dg/alias.m: Update. * objc.dg/class-1.m: Update. * objc.dg/const-str-1.m: Update. * objc.dg/fwd-proto-1.m: Update. * objc.dg/id-1.m: Update. * objc.dg/super-class-1.m: Update. From-SVN: r47518
2001-12-02 01:04:36 +01:00
error ("cannot find interface declaration for `%s'",
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)))
{
c-decl.c (duplicate_decls, [...]): Remove leading capital from diagnostics. * c-decl.c (duplicate_decls, push_parm_decl): Remove leading capital from diagnostics. * c-lex.c (cb_file_change): Similarly. * c-parse.in : Similarly. * cfgrtl.c (verify_flow_info): Similarly. * collect2.c: Similarly. * cppfiles.c (find_include_file): Similarly. * cppinit.c (cpp_handle_option): Similarly. * cpplex.c (cpp_spell_token): Similarly. * cppmain.c (do_preprocessing): Similarly. * gcc.c (translate_options, process_command, do_spec1, main, pfatal_execute): Similarly. * genattr.c (main): Similarly. * genattrtab.c (check_attr_test, operate_exp, simplify_test_exp, write_test_expr, main): Similarly. * gencodes.c (main): Similarly. * genconfig.c (main): Similarly. * genconstants.c (main): Similarly. * genemit.c (main): Similarly. * genextract.c (main): Similarly. * genflags.c (main): Similarly. * genopinit.c (main): Similarly. * genoutput.c (process_template, main): Similarly. * genpeep.c (main): Similarly. * genrecog.c (main): Similarly. * gensupport.c (is_predicable, identify_predicable_attribute, alter_predicate_for_insn, init_md_reader_args, main): Similarly. * ggc-page.c (alloc_anon): Similarly. * mips-tfile.c (add_string, add_procedure, add_file, read_line, parse_begin, parse_bend, parse_def, parse_end, parse_file, parse_stabs_common, parse_stabs, write_varray, write_object, read_seek, copy_object, main, error): Similarly. * profile.c (compute_branch_probabilities): Similarly. * reg-stack.c (check_asm_stack_operands): Similarly. * reload.c (find_reloads): Similarly. * reload1.c (spill_failure, failed_reload): Similarly. * rtl-error.c (_fatal_insn_not_found): Similarly. * toplev.c (read_integral_parameter, crash_signal, decode_f_option, set_target_switch, parse_options_and_default_flags) : Similarly. * tradcif.y (parse_number, yylex): Similarly. * tradcpp.c (main, fancy_abort): Similarly. * tree.c (tree_check_failed): Similarly. * varray.c (varray_check_failed): Similarly. * xcoffout.c (xcoff_output_standard_types): Similarly. cp: * call.c (build_java_interface_fn_ref): Similarly. * except.c (is_admissible_throw_operand): Similarly. * init.c (build_java_class_ref): Similarly. * xref.c (open_xref_file): Similarly. objc: * objc-act.c (get_object_ref, lookup_and_install_protocols, build_objc_string_object, objc_declare_alias, build_ivar_chain, finish_message_expr, build_protocol_expr, is_public, start_class): Similarly. testsuite: * objc.dg/alias.m: Update. * objc.dg/class-1.m: Update. * objc.dg/const-str-1.m: Update. * objc.dg/fwd-proto-1.m: Update. * objc.dg/id-1.m: Update. * objc.dg/super-class-1.m: Update. From-SVN: r47518
2001-12-02 01:04:36 +01:00
error ("cannot find interface declaration for `%s'",
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
tree ivar_context;
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
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
ivar_context = build_private_template (implementation_template);
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;
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 */
1992-01-18 00:15:38 +01:00
return ivar_context;
}
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 */
if (!CLASS_STATIC_TEMPLATE (class))
1992-01-18 00:15:38 +01:00
{
tree record = start_struct (RECORD_TYPE, CLASS_NAME (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
finish_struct (record, get_class_ivars (class), NULL_TREE);
1992-01-18 00:15:38 +01:00
CLASS_STATIC_TEMPLATE (class) = record;
/* Mark this record as a class template for static typing. */
1992-01-18 00:15:38 +01:00
TREE_STATIC_TEMPLATE (record) = 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 /* 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
}
}
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
tree decl;
const char *class_name = IDENTIFIER_POINTER (CLASS_NAME (class));
char *string = (char *) alloca (strlen (class_name) + 3);
1992-01-18 00:15:38 +01:00
/* extern struct objc_object *_<my_name>; */
sprintf (string, "_%s", class_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
decl = build_decl (VAR_DECL, get_identifier (string),
build_pointer_type (objc_object_reference));
DECL_EXTERNAL (decl) = 1;
lang_hooks.decls.pushdecl (decl);
finish_decl (decl, NULL_TREE, NULL_TREE);
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
{
warning ("duplicate declaration for protocol `%s'",
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;
}
else if (TREE_STATIC_TEMPLATE (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;
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
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;
}
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. */
int pointed_to
= (obstack_object_size (&util_obstack) > 0
&& *(obstack_next_free (&util_obstack) - 1) == '^');
int inline_contents
= ((format == OBJC_ENCODE_INLINE_DEFS || generating_instance_variables)
&& (!pointed_to || obstack_object_size (&util_obstack) - curtype == 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
{
tree fields = TYPE_FIELDS (type);
obstack_1grow (&util_obstack, '=');
for (; fields; fields = TREE_CHAIN (fields))
{
#ifdef OBJCPLUS
/* C++ static members, and things that are not fields at all,
should not appear in the encoding. */
if (TREE_CODE (fields) != FIELD_DECL || TREE_STATIC (fields))
continue;
#endif
if (generating_instance_variables && !pointed_to)
{
tree fname = DECL_NAME (fields);
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 (fields, 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 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, '?');
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)
{
/* Convert array parameters of unknown size into pointers. */
if (TREE_CODE (TREE_TYPE (parm)) == ARRAY_TYPE
&& !TYPE_SIZE (TREE_TYPE (parm)))
TREE_TYPE (parm) = build_pointer_type (TREE_TYPE (TREE_TYPE (parm)));
objc_parmlist = chainon (objc_parmlist, parm);
}
/* Retrieve the formal paramter list constructed via preceding calls to
objc_push_parm(). */
1992-01-18 00:15:38 +01: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
#ifdef OBJCPLUS
objc_get_parm_info (int have_ellipsis ATTRIBUTE_UNUSED)
#else
objc_get_parm_info (int have_ellipsis)
#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 parm_info = objc_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
#ifndef OBJCPLUS
/* 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;
pushdecl (parm_info);
parm_info = next;
}
parm_info = get_parm_info (have_ellipsis);
pop_scope ();
#endif
objc_parmlist = 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 parm_info;
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;
int have_ellipsis = 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
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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 = build_decl (PARM_DECL, KEYWORD_ARG_NAME (parmlist),
TREE_VALUE (TREE_TYPE (parmlist)));
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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));
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 (TREE_OVERFLOW (METHOD_ADD_ARGS (method)))
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
parmlist = objc_get_parm_info (have_ellipsis);
really_start_method (objc_method_context, parmlist);
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. */
warning ("%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
type1 = TYPE_PROTOCOL_LIST (type1);
type2 = TYPE_PROTOCOL_LIST (type2);
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;
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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
for purposes of method overloading. */
static int
comp_proto_with_proto (tree proto1, tree proto2)
{
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));
if (!objc_types_are_equivalent (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))
{
if (!objc_types_are_equivalent (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
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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 name, tree type, tree attrs, tree params)
{
tree fndecl = build_decl (FUNCTION_DECL, name, type);
DECL_ARGUMENTS (fndecl) = params;
DECL_INITIAL (fndecl) = error_mark_node;
DECL_EXTERNAL (fndecl) = 0;
TREE_STATIC (fndecl) = 1;
#ifdef OBJCPLUS
retrofit_lang_decl (fndecl);
cplus_decl_attributes (&fndecl, attrs, 0);
start_preparsed_function (fndecl, attrs, /*flags=*/SF_DEFAULT);
#else
decl_attributes (&fndecl, attrs, 0);
announce_function (fndecl);
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)));
start_fname_decls ();
store_parm_decls_from (DECL_ARGUMENTS (current_function_decl));
#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
really_start_method (tree method, 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
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),
TREE_CODE (method) == CLASS_METHOD_DECL);
1992-01-18 00:15:38 +01:00
if (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 (!comp_proto_with_proto (method, proto))
{
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. */
super_expr = 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. */
super_expr = 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
{
error ("no super class declared in interface for `%s'",
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,
my_build_string (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;
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
{
fprintf (stderr, "In method `%s'\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))
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 (type));
if (!POINTER_TYPE_P (TREE_TYPE (type)))
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, "*");
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
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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 (type));
proto = TYPE_PROTOCOL_LIST (orig);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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,
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 (TREE_OVERFLOW (METHOD_ADD_ARGS (method)))
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] == '_')
{
cp = demangled = xmalloc(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
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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 = (char *) xmalloc (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)
{
warning ("`@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 ();
generate_shared_structures ();
}
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 ();
if (flag_replace_objc_classes && imp_list)
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
1996-07-04 00:07:53 +02:00
/* Dump the string table last. */
generate_strings ();
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;
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;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (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));
initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 1), 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. */
tree
objc_lookup_ivar (tree id)
{
tree decl;
if (objc_method_context && !strcmp (IDENTIFIER_POINTER (id), "super"))
/* We have a message to super. */
return get_super_receiver ();
else if (objc_method_context && (decl = is_ivar (objc_ivar_chain, id)))
{
if (is_private (decl))
return 0;
else
return build_ivar_reference (id);
}
else
return 0;
}
#include "gt-objc-objc-act.h"