diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-08-21 00:50:39 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-08-21 00:50:39 +0000 |
commit | 71ccdfff0e9520486c8b8e75ca6894c0b505683b (patch) | |
tree | c9fa739ae50f1adb0f63b8a81e6fb2113c2dacc5 /gcc/cp | |
parent | 51f06ef8196b15424635f0333bbad4474989162f (diff) | |
download | gcc-71ccdfff0e9520486c8b8e75ca6894c0b505683b.tar.gz |
Wed Aug 20 17:25:08 1997 Jason Merrill <jason@yorick.cygnus.com>
* call.c (is_subseq): Don't try to be clever.
Wed Aug 20 03:13:36 1997 H.J. Lu (hjl@gnu.ai.mit.edu)
* parse.y, pt.c: Include "except.h".
* call.c, class.c, class.h, cp-tree.h, cvt.c, decl.c, decl2.c,
error.c, except.c, expr.c, friend.c, g++spec.c, init.c, input.c,
lex.c, lex.h, method.c, parse.y, pt.c, repo.c, rtti.c, search.c,
sig.c, spew.c, tree.c, typeck.c, typeck2.c, xref.c: Finish
prototyping.
Wed Aug 20 01:34:40 1997 Jason Merrill <jason@yorick.cygnus.com>
* decl2.c (mark_vtable_entries): Instead of replacing pure
virtuals with a reference to __pure_virtual, copy the decl and
change the RTL.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@14868 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 19 | ||||
-rw-r--r-- | gcc/cp/call.c | 73 | ||||
-rw-r--r-- | gcc/cp/class.c | 43 | ||||
-rw-r--r-- | gcc/cp/class.h | 2 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 59 | ||||
-rw-r--r-- | gcc/cp/cvt.c | 14 | ||||
-rw-r--r-- | gcc/cp/decl.c | 45 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 44 | ||||
-rw-r--r-- | gcc/cp/error.c | 36 | ||||
-rw-r--r-- | gcc/cp/except.c | 11 | ||||
-rw-r--r-- | gcc/cp/expr.c | 3 | ||||
-rw-r--r-- | gcc/cp/friend.c | 7 | ||||
-rw-r--r-- | gcc/cp/g++spec.c | 8 | ||||
-rw-r--r-- | gcc/cp/init.c | 26 | ||||
-rw-r--r-- | gcc/cp/input.c | 14 | ||||
-rw-r--r-- | gcc/cp/lex.c | 65 | ||||
-rw-r--r-- | gcc/cp/lex.h | 5 | ||||
-rw-r--r-- | gcc/cp/method.c | 22 | ||||
-rw-r--r-- | gcc/cp/parse.y | 11 | ||||
-rw-r--r-- | gcc/cp/pt.c | 24 | ||||
-rw-r--r-- | gcc/cp/repo.c | 18 | ||||
-rw-r--r-- | gcc/cp/rtti.c | 17 | ||||
-rw-r--r-- | gcc/cp/search.c | 79 | ||||
-rw-r--r-- | gcc/cp/sig.c | 18 | ||||
-rw-r--r-- | gcc/cp/spew.c | 6 | ||||
-rw-r--r-- | gcc/cp/tree.c | 32 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 39 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 3 | ||||
-rw-r--r-- | gcc/cp/xref.c | 46 |
29 files changed, 587 insertions, 202 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ed0250efc3b..6744f7320bf 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,22 @@ +Wed Aug 20 17:25:08 1997 Jason Merrill <jason@yorick.cygnus.com> + + * call.c (is_subseq): Don't try to be clever. + +Wed Aug 20 03:13:36 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * parse.y, pt.c: Include "except.h". + * call.c, class.c, class.h, cp-tree.h, cvt.c, decl.c, decl2.c, + error.c, except.c, expr.c, friend.c, g++spec.c, init.c, input.c, + lex.c, lex.h, method.c, parse.y, pt.c, repo.c, rtti.c, search.c, + sig.c, spew.c, tree.c, typeck.c, typeck2.c, xref.c: Finish + prototyping. + +Wed Aug 20 01:34:40 1997 Jason Merrill <jason@yorick.cygnus.com> + + * decl2.c (mark_vtable_entries): Instead of replacing pure + virtuals with a reference to __pure_virtual, copy the decl and + change the RTL. + Tue Aug 19 02:26:07 1997 Jason Merrill <jason@yorick.cygnus.com> * pt.c (lookup_nested_type_by_name): Handle typedef wierdness. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 2f5e8e61465..cdec02df92d 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -31,12 +31,14 @@ Boston, MA 02111-1307, USA. */ #include "output.h" #include "flags.h" +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#endif + #include "obstack.h" #define obstack_chunk_alloc xmalloc #define obstack_chunk_free free -extern void sorry (); - extern int inhibit_warnings; extern tree ctor_label, dtor_label; @@ -46,6 +48,59 @@ extern tree ctor_label, dtor_label; static struct harshness_code convert_harshness PROTO((register tree, register tree, tree)); static tree build_new_method_call PROTO((tree, tree, tree, tree, int)); +static int rank_for_ideal PROTO((struct candidate *, + struct candidate *)); +static int user_harshness PROTO((tree, tree)); +static int strictly_better PROTO((unsigned short, unsigned short)); +static struct candidate * ideal_candidate PROTO((struct candidate *, + int, int)); +static int may_be_remote PROTO((tree)); +static tree build_field_call PROTO((tree, tree, tree, tree)); +static tree find_scoped_type PROTO((tree, tree, tree)); +static void print_candidates PROTO((tree)); +static struct z_candidate * tourney PROTO((struct z_candidate *)); +static int joust PROTO((struct z_candidate *, struct z_candidate *)); +static int compare_qual PROTO((tree, tree)); +static int compare_ics PROTO((tree, tree)); +static tree build_over_call PROTO((tree, tree, tree, int)); +static tree convert_default_arg PROTO((tree, tree)); +static void enforce_access PROTO((tree, tree)); +static tree convert_like PROTO((tree, tree)); +static void op_error PROTO((enum tree_code, enum tree_code, tree, tree, + tree, char *)); +static tree build_object_call PROTO((tree, tree)); +static tree resolve_args PROTO((tree)); +static struct z_candidate * build_user_type_conversion_1 + PROTO ((tree, tree, int)); +static void print_z_candidates PROTO((struct z_candidate *)); +static tree build_this PROTO((tree)); +static struct z_candidate * splice_viable PROTO((struct z_candidate *)); +static int any_viable PROTO((struct z_candidate *)); +static struct z_candidate * add_template_candidate + PROTO((struct z_candidate *, tree, tree, int)); +static struct z_candidate * add_builtin_candidates + PROTO((struct z_candidate *, enum tree_code, enum tree_code, + tree, tree *, int)); +static struct z_candidate * add_builtin_candidate + PROTO((struct z_candidate *, enum tree_code, enum tree_code, + tree, tree, tree, tree *, tree *, int)); +static int is_complete PROTO((tree)); +static struct z_candidate * build_builtin_candidate + PROTO((struct z_candidate *, tree, tree, tree, tree *, tree *, + int)); +static struct z_candidate * add_conv_candidate + PROTO((struct z_candidate *, tree, tree, tree)); +static struct z_candidate * add_function_candidate + PROTO((struct z_candidate *, tree, tree, int)); +static tree implicit_conversion PROTO((tree, tree, tree, int)); +static tree standard_conversion PROTO((tree, tree, tree)); +static tree reference_binding PROTO((tree, tree, tree, int)); +static tree strip_top_quals PROTO((tree)); +static tree non_reference PROTO((tree)); +static tree build_conv PROTO((enum tree_code, tree, tree)); +static void print_n_candidates PROTO((struct candidate *, int)); +static tree default_parm_conversions PROTO((tree, tree *)); + #define EVIL_RETURN(ARG) ((ARG).code = EVIL_CODE, (ARG)) #define STD_RETURN(ARG) ((ARG).code = STD_CODE, (ARG)) #define QUAL_RETURN(ARG) ((ARG).code = QUAL_CODE, (ARG)) @@ -1072,7 +1127,7 @@ ideal_candidate (candidates, n_candidates, len) functions. */ qsort (candidates, n_candidates, sizeof (struct candidate), - rank_for_overload); + (int (*) PROTO((const void *, const void *))) rank_for_overload); best_code = cp[-1].h.code; /* If they're at least as good as each other, do an arg-by-arg check. */ @@ -1086,7 +1141,7 @@ ideal_candidate (candidates, n_candidates, len) break; qsort (candidates+j, n_candidates-j, sizeof (struct candidate), - rank_for_ideal); + (int (*) PROTO((const void *, const void *))) rank_for_ideal); for (i = 0; i < len; i++) { if (cp[-1].harshness[i].code < cp[-2].harshness[i].code) @@ -2936,12 +2991,6 @@ struct z_candidate { #define USER_CONV_FN(NODE) TREE_OPERAND (NODE, 1) -static struct z_candidate * build_user_type_conversion_1 (); -static tree convert_like (); -static tree build_over_call (); -static struct z_candidate * tourney (); -static void enforce_access (); - int null_ptr_cst_p (t) tree t; @@ -5460,10 +5509,8 @@ static int is_subseq (ics1, ics2) tree ics1, ics2; { - for (;;) + for (;; ics2 = TREE_OPERAND (ics2, 0)) { - ics2 = TREE_OPERAND (ics2, 0); - if (TREE_CODE (ics2) == TREE_CODE (ics1) && comptypes (TREE_TYPE (ics2), TREE_TYPE (ics1), 1) && comptypes (TREE_TYPE (TREE_OPERAND (ics2, 0)), diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 0d33c80f88f..3270bff5dbd 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -82,7 +82,50 @@ tree current_class_type; /* _TYPE: the type of the current class */ tree previous_class_type; /* _TYPE: the previous type that was a class */ tree previous_class_values; /* TREE_LIST: copy of the class_shadowed list when leaving an outermost class scope. */ + +struct base_info; + static tree get_vfield_name PROTO((tree)); +static void finish_struct_anon PROTO((tree)); +static tree build_vbase_pointer PROTO((tree, tree)); +static int complete_type_p PROTO((tree)); +static int typecode_p PROTO((tree, enum tree_code)); +static tree build_vtable_entry PROTO((tree, tree)); +static tree get_vtable_name PROTO((tree)); +static tree get_derived_offset PROTO((tree, tree)); +static tree get_basefndecls PROTO((tree, tree)); +static void set_rtti_entry PROTO((tree, tree, tree)); +static tree build_vtable PROTO((tree, tree)); +static tree build_type_pathname PROTO((char *, tree, tree)); +static void prepare_fresh_vtable PROTO((tree, tree)); +static void fixup_vtable_deltas1 PROTO((tree, tree)); +static void fixup_vtable_deltas PROTO((tree, int, tree)); +static void grow_method PROTO((tree, tree *)); +static void finish_vtbls PROTO((tree, int, tree)); +static void modify_vtable_entry PROTO((tree, tree, tree)); +static tree get_vtable_entry_n PROTO((tree, unsigned HOST_WIDE_INT)); +static tree add_virtual_function PROTO((tree, int *, tree, tree)); +static tree delete_duplicate_fields_1 PROTO((tree, tree)); +static void delete_duplicate_fields PROTO((tree)); +static void finish_struct_bits PROTO((tree, int)); +static int alter_access PROTO((tree, tree, tree)); +static int overrides PROTO((tree, tree)); +static int strictly_overrides PROTO((tree, tree)); +static void merge_overrides PROTO((tree, tree, int, tree)); +static void override_one_vtable PROTO((tree, tree, tree)); +static void mark_overriders PROTO((tree, tree)); +static void check_for_override PROTO((tree, tree)); +static tree maybe_fixup_vptrs PROTO((tree, tree, tree)); +static tree get_class_offset_1 PROTO((tree, tree, tree, tree, tree)); +static tree get_class_offset PROTO((tree, tree, tree, tree)); +static void modify_one_vtable PROTO((tree, tree, tree, tree)); +static void modify_all_vtables PROTO((tree, tree, tree)); +static void modify_all_direct_vtables PROTO((tree, int, tree, tree, + tree)); +static void modify_all_indirect_vtables PROTO((tree, int, int, tree, + tree, tree)); +static void build_class_init_list PROTO((tree)); +static int finish_base_struct PROTO((tree, struct base_info *, tree)); /* Way of stacking language names. */ tree *current_lang_base, *current_lang_stack; diff --git a/gcc/cp/class.h b/gcc/cp/class.h index 1c83d5beb7a..12e45f78415 100644 --- a/gcc/cp/class.h +++ b/gcc/cp/class.h @@ -103,7 +103,7 @@ struct candidate -5 if contravariance violation. */ } u; }; -int rank_for_overload (); +int rank_for_overload PROTO ((struct candidate *, struct candidate *)); /* Variables shared between class.c and call.c. */ diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index b8edc52b0cb..e1383978705 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -1424,7 +1424,7 @@ extern int flag_new_for_scope; #define DEFARG_POINTER(NODE) IDENTIFIER_POINTER(NODE) #define builtin_function(NAME, TYPE, CODE, LIBNAME) \ - define_function (NAME, TYPE, CODE, (void (*)())pushdecl, LIBNAME) + define_function (NAME, TYPE, CODE, (void (*) PROTO((tree)))pushdecl, LIBNAME) /* An enumeration of the kind of tags that C++ accepts. */ enum tag_types { record_type, class_type, union_type, enum_type, @@ -1976,6 +1976,7 @@ extern void print_class_statistics PROTO((void)); extern void maybe_push_cache_obstack PROTO((void)); extern unsigned HOST_WIDE_INT skip_rtti_stuff PROTO((tree *)); extern tree build_self_reference PROTO((void)); +extern void warn_hidden PROTO((tree)); /* in cvt.c */ extern tree convert_to_reference PROTO((tree, tree, int, int, tree)); @@ -2006,15 +2007,15 @@ extern void pushlevel PROTO((int)); extern void note_level_for_for PROTO((void)); extern void pushlevel_temporary PROTO((int)); extern tree poplevel PROTO((int, int, int)); -/* resume_level */ +extern void resume_level PROTO((struct binding_level *)); extern void delete_block PROTO((tree)); extern void insert_block PROTO((tree)); extern void add_block_current_level PROTO((tree)); extern void set_block PROTO((tree)); extern void pushlevel_class PROTO((void)); extern tree poplevel_class PROTO((int)); -/* skip print_other_binding_stack and print_binding_level */ extern void print_binding_stack PROTO((void)); +extern void print_binding_level PROTO((struct binding_level *)); extern void push_namespace PROTO((tree)); extern void pop_namespace PROTO((void)); extern void maybe_push_to_top_level PROTO((int)); @@ -2055,7 +2056,9 @@ extern tree lookup_name_current_level PROTO((tree)); extern tree auto_function PROTO((tree, tree, enum built_in_function)); extern void init_decl_processing PROTO((void)); extern int init_type_desc PROTO((void)); -/* skipped define_function */ +extern tree define_function + PROTO((char *, tree, enum built_in_function, + void (*) (tree), char *)); extern void shadow_tag PROTO((tree)); extern tree groktypename PROTO((tree)); extern tree start_decl PROTO((tree, tree, int)); @@ -2094,6 +2097,9 @@ extern int id_in_current_class PROTO((tree)); extern void push_cp_function_context PROTO((tree)); extern void pop_cp_function_context PROTO((tree)); extern int in_function_p PROTO((void)); +extern void replace_defarg PROTO((tree, tree)); +extern void print_other_binding_stack PROTO((struct binding_level *)); +extern tree strip_attrs PROTO((tree)); /* in decl2.c */ extern int flag_assume_nonnull_objects; @@ -2127,8 +2133,10 @@ extern tree coerce_delete_type PROTO((tree)); extern void comdat_linkage PROTO((tree)); extern void import_export_vtable PROTO((tree, tree, int)); extern int finish_prevtable_vardecl PROTO((tree, tree)); -extern int walk_vtables PROTO((void (*)(), int (*)())); -extern void walk_sigtables PROTO((void (*)(), void (*)())); +extern int walk_vtables PROTO((void (*)(tree, tree), + int (*)(tree, tree))); +extern void walk_sigtables PROTO((void (*)(tree, tree), + void (*)(tree, tree))); extern void import_export_decl PROTO((tree)); extern tree build_cleanup PROTO((tree)); extern void finish_file PROTO((void)); @@ -2146,6 +2154,7 @@ extern tree do_class_using_decl PROTO((tree)); extern void do_using_directive PROTO((tree)); extern void check_default_args PROTO((tree)); extern void mark_used PROTO((tree)); +extern tree handle_class_head PROTO((tree, tree, tree)); /* in errfn.c */ extern void cp_error (); @@ -2171,6 +2180,8 @@ extern char *op_as_string PROTO((enum tree_code, int)); extern char *assop_as_string PROTO((enum tree_code, int)); extern char *cv_as_string PROTO((tree, int)); extern char *lang_decl_name PROTO((tree, int)); +extern char *cp_file_of PROTO((tree)); +extern int cp_line_of PROTO((tree)); /* in except.c */ extern void init_exception_processing PROTO((void)); @@ -2240,13 +2251,11 @@ extern void print_parse_statistics PROTO((void)); extern void extract_interface_info PROTO((void)); extern void do_pending_inlines PROTO((void)); extern void process_next_inline PROTO((tree)); -/* skip save_pending_input */ -/* skip restore_pending_input */ +extern struct pending_input *save_pending_input PROTO((void)); +extern void restore_pending_input PROTO((struct pending_input *)); extern void yyungetc PROTO((int, int)); extern void reinit_parse_for_method PROTO((int, tree)); -#if 0 extern void reinit_parse_for_block PROTO((int, struct obstack *)); -#endif extern tree cons_up_default_function PROTO((tree, tree, int)); extern void check_for_missing_semicolon PROTO((tree)); extern void note_got_semicolon PROTO((tree)); @@ -2266,6 +2275,12 @@ extern tree make_lang_type PROTO((enum tree_code)); extern void dump_time_statistics PROTO((void)); /* extern void compiler_error PROTO((char *, HOST_WIDE_INT, HOST_WIDE_INT)); */ extern void yyerror PROTO((char *)); +extern void clear_inline_text_obstack PROTO((void)); +extern void maybe_snarf_defarg PROTO((void)); +extern tree snarf_defarg PROTO((void)); +extern void add_defarg_fn PROTO((tree)); +extern void do_pending_defargs PROTO((void)); +extern int identifier_type PROTO((tree)); /* in method.c */ extern void init_method PROTO((void)); @@ -2281,6 +2296,7 @@ extern tree hack_identifier PROTO((tree, tree)); extern tree make_thunk PROTO((tree, int)); extern void emit_thunk PROTO((tree)); extern void synthesize_method PROTO((tree)); +extern tree get_id_2 PROTO((char *, tree)); /* in pt.c */ extern tree tsubst PROTO ((tree, tree*, int, tree)); @@ -2312,6 +2328,11 @@ extern tree *get_bindings PROTO((tree, tree)); /* CONT ... */ extern void add_tree PROTO((tree)); extern void add_maybe_template PROTO((tree, tree)); +extern void pop_tinst_level PROTO((void)); +extern tree most_specialized PROTO((tree, tree)); +extern tree most_specialized_class PROTO((tree, tree)); +extern int more_specialized_class PROTO((tree, tree)); +extern void do_pushlevel PROTO((void)); /* in repo.c */ extern void repo_template_used PROTO((tree)); @@ -2355,7 +2376,7 @@ extern void add_mi_virtuals PROTO((int, tree)); extern void report_ambiguous_mi_virtuals PROTO((int, tree)); extern void note_debug_info_needed PROTO((tree)); extern void push_class_decls PROTO((tree)); -extern void pop_class_decls PROTO(()); +extern void pop_class_decls PROTO((void)); extern void unuse_fields PROTO((tree)); extern void unmark_finished_struct PROTO((tree)); extern void print_search_statistics PROTO((void)); @@ -2375,7 +2396,7 @@ extern void append_signature_fields PROTO((tree)); /* in spew.c */ extern void init_spew PROTO((void)); -extern int peek_yylex PROTO((void)); +extern int peekyylex PROTO((void)); extern int yylex PROTO((void)); extern tree arbitrate_lookup PROTO((tree, tree, tree)); @@ -2410,12 +2431,12 @@ extern tree fnaddr_from_vtable_entry PROTO((tree)); extern tree function_arg_chain PROTO((tree)); extern int promotes_to_aggr_type PROTO((tree, enum tree_code)); extern int is_aggr_type_2 PROTO((tree, tree)); -extern void message_2_types PROTO((void (*)(), char *, tree, tree)); extern char *lang_printable_name PROTO((tree, int)); extern tree build_exception_variant PROTO((tree, tree)); extern tree copy_to_permanent PROTO((tree)); extern void print_lang_statistics PROTO((void)); -/* skip __eprintf */ +extern void __eprintf + PROTO((const char *, const char *, unsigned, const char *)); extern tree array_type_nelts_total PROTO((tree)); extern tree array_type_nelts_top PROTO((tree)); extern tree break_out_target_exprs PROTO((tree)); @@ -2424,6 +2445,13 @@ extern tree vec_binfo_member PROTO((tree, tree)); extern tree hack_decl_function_context PROTO((tree)); extern tree lvalue_type PROTO((tree)); extern tree error_type PROTO((tree)); +extern tree make_temp_vec PROTO((int)); +extern int varargs_function_p PROTO((tree)); +extern int really_overloaded_fn PROTO((tree)); +extern int cp_tree_equal PROTO((tree, tree)); +extern int can_free PROTO((struct obstack *, tree)); +extern tree mapcar PROTO((tree, tree (*) (tree))); +extern void debug_binfo PROTO((tree)); /* in typeck.c */ extern tree condition_conversion PROTO((tree)); @@ -2509,7 +2537,8 @@ extern tree build_m_component_ref PROTO((tree, tree)); extern tree build_functional_cast PROTO((tree, tree)); extern char *enum_name_string PROTO((tree, tree)); extern void report_case_error PROTO((int, tree, tree, tree)); -extern void check_for_new_typeid PROTO((char *,flagged_type_tree)); +extern void check_for_new_type PROTO((char *,flagged_type_tree)); +extern tree initializer_constant_valid_p PROTO((tree, tree)); /* in xref.c */ extern void GNU_xref_begin PROTO((char *)); diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 20e86e0096f..b488c0d343e 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -33,8 +33,20 @@ Boston, MA 02111-1307, USA. */ #include "class.h" #include "convert.h" +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#endif + extern tree static_aggregates; +static tree build_thunk PROTO((tree, tree)); +static tree convert_fn_ptr PROTO((tree, tree)); +static tree cp_convert_to_pointer PROTO((tree, tree)); +static tree convert_to_pointer_force PROTO((tree, tree)); +static tree build_up_reference PROTO((tree, tree, int, int)); +static tree build_type_conversion_1 PROTO((tree, tree, tree, tree, + int)); + /* Change of width--truncation and extension of integers or reals-- is represented with NOP_EXPR. Proper functioning of many things assumes that no other conversions can be NOP_EXPRs. @@ -780,7 +792,7 @@ convert_to_aggr (type, expr, msgp, protect) qsort (candidates, /* char *base */ cp - candidates, /* int nel */ sizeof (struct candidate), /* int width */ - rank_for_overload); /* int (*compar)() */ + (int (*) PROTO((const void *, const void *))) rank_for_overload); /* int (*compar)() */ --cp; if (cp->h.code & EVIL_CODE) diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 63e42b805c2..fff54e64a58 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -39,6 +39,8 @@ Boston, MA 02111-1307, USA. */ #include <signal.h> #include "obstack.h" #include "defaults.h" +#include "output.h" +#include "except.h" #define obstack_chunk_alloc xmalloc #define obstack_chunk_free free @@ -130,8 +132,43 @@ static void revert_static_member_fn PROTO((tree *, tree *, tree *)); static tree push_overloaded_decl PROTO((tree, int)); static void push_overloaded_decl_top_level PROTO((tree, int)); -tree define_function - PROTO((char *, tree, enum built_in_function, void (*)(), char *)); +static struct stack_level *push_decl_level PROTO((struct stack_level *, + struct obstack *)); +static void push_binding_level PROTO((struct binding_level *, int, + int)); +static void pop_binding_level PROTO((void)); +static void suspend_binding_level PROTO((void)); +static void resume_binding_level PROTO((struct binding_level *)); +static struct binding_level *make_binding_level PROTO((void)); +static int namespace_bindings_p PROTO((void)); +static void declare_namespace_level PROTO((void)); +static tree get_unique_name PROTO((void)); +static void signal_catch PROTO((int)); +static void storedecls PROTO((tree)); +static void storetags PROTO((tree)); +static void require_complete_types_for_parms PROTO((tree)); +static void push_overloaded_decl_1 PROTO((tree)); +static int ambi_op_p PROTO((tree)); +static int unary_op_p PROTO((tree)); +static tree store_bindings PROTO((tree, tree)); +static tree lookup_tag_reverse PROTO((tree, tree)); +static tree obscure_complex_init PROTO((tree, tree)); +static tree maybe_build_cleanup_1 PROTO((tree, tree)); +static tree lookup_name_real PROTO((tree, int, int)); +static void warn_extern_redeclared_static PROTO((tree, tree)); +static void grok_reference_init PROTO((tree, tree, tree, tree *)); +static tree grokfndecl PROTO((tree, tree, tree, int, + enum overload_flags, + tree, tree, tree, int, int, int, int)); +static tree grokvardecl PROTO((tree, tree, RID_BIT_TYPE *, int, int)); +static tree lookup_tag PROTO((enum tree_code, tree, + struct binding_level *, int)); +static void set_identifier_type_value_with_scope + PROTO((tree, tree, struct binding_level *)); +static void record_builtin_type PROTO((enum rid, char *, tree)); +static int member_function_or_else PROTO((tree, tree, char *)); +static void bad_specifiers PROTO((tree, char *, int, int, int, int, + int)); /* a node which has tree code ERROR_MARK, and whose type is itself. All erroneous expressions are replaced with this node. All functions @@ -4625,7 +4662,7 @@ auto_function (name, type, code) enum built_in_function code; { return define_function - (IDENTIFIER_POINTER (name), type, code, (void (*)())push_overloaded_decl_1, + (IDENTIFIER_POINTER (name), type, code, push_overloaded_decl_1, IDENTIFIER_POINTER (build_decl_overload (name, TYPE_ARG_TYPES (type), 0))); } @@ -5555,7 +5592,7 @@ define_function (name, type, function_code, pfn, library_name) char *name; tree type; enum built_in_function function_code; - void (*pfn)(); + void (*pfn) PROTO((tree)); char *library_name; { tree decl = build_lang_decl (FUNCTION_DECL, get_identifier (name), type); diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 0bfd43de33b..701489e974b 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -36,10 +36,26 @@ Boston, MA 02111-1307, USA. */ #include "decl.h" #include "lex.h" #include "output.h" +#include "except.h" extern tree get_file_function_name (); + +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#endif + +#ifdef HAVE_STRING_H +#include <string.h> +#endif + +static tree get_sentry PROTO((tree)); +static void mark_vtable_entries PROTO((tree)); +static void import_export_template PROTO((tree)); static void grok_function_init PROTO((tree, tree)); -void import_export_decl (); +static int finish_vtable_vardecl PROTO((tree, tree)); +static int prune_vtable_vardecl PROTO((tree, tree)); +static void finish_sigtable_vardecl PROTO((tree, tree)); + extern int current_class_depth; /* A list of virtual function tables we must make sure to write out. */ @@ -2324,7 +2340,10 @@ mark_vtable_entries (decl) tree fn = TREE_OPERAND (fnaddr, 0); TREE_ADDRESSABLE (fn) = 1; if (DECL_LANG_SPECIFIC (fn) && DECL_ABSTRACT_VIRTUAL_P (fn)) - TREE_OPERAND (fnaddr, 0) = fn = abort_fndecl; + { + TREE_OPERAND (fnaddr, 0) = fn = copy_node (fn); + DECL_RTL (fn) = DECL_RTL (abort_fndecl); + } if (TREE_CODE (fn) == THUNK_DECL && DECL_EXTERNAL (fn)) { DECL_EXTERNAL (fn) = 0; @@ -2520,8 +2539,8 @@ prune_vtable_vardecl (prev, vars) int walk_vtables (typedecl_fn, vardecl_fn) - register void (*typedecl_fn)(); - register int (*vardecl_fn)(); + register void (*typedecl_fn) PROTO ((tree, tree)); + register int (*vardecl_fn) PROTO ((tree, tree)); { tree prev, vars; int flag = 0; @@ -2568,8 +2587,8 @@ finish_sigtable_vardecl (prev, vars) void walk_sigtables (typedecl_fn, vardecl_fn) - register void (*typedecl_fn)(); - register void (*vardecl_fn)(); + register void (*typedecl_fn) PROTO((tree, tree)); + register void (*vardecl_fn) PROTO((tree, tree)); { tree prev, vars; @@ -2697,7 +2716,6 @@ extern tree pending_templates; extern tree maybe_templates; extern struct obstack permanent_obstack; -extern tree get_id_2 (); static tree get_sentry (base) @@ -2814,7 +2832,8 @@ finish_file () /* Walk to mark the inline functions we need, then output them so that we can pick up any other tdecls that those routines need. */ - walk_vtables ((void (*)())0, finish_prevtable_vardecl); + walk_vtables ((void (*) PROTO ((tree, tree))) 0, + finish_prevtable_vardecl); for (vars = pending_statics; vars; vars = TREE_CHAIN (vars)) { @@ -3056,7 +3075,8 @@ finish_file () start_time = get_run_time (); if (flag_handle_signatures) - walk_sigtables ((void (*)())0, finish_sigtable_vardecl); + walk_sigtables ((void (*) PROTO ((tree, tree))) 0, + finish_sigtable_vardecl); for (fnname = saved_inlines; fnname; fnname = TREE_CHAIN (fnname)) { @@ -3082,7 +3102,8 @@ finish_file () SET_DECL_ARTIFICIAL (vars); pushdecl (vars); - reconsider |= walk_vtables ((void (*)())0, finish_vtable_vardecl); + reconsider |= walk_vtables ((void (*) PROTO((tree, tree))) 0, + finish_vtable_vardecl); while (*p) { @@ -3138,7 +3159,8 @@ finish_file () /* Now delete from the chain of variables all virtual function tables. We output them all ourselves, because each will be treated specially. */ - walk_vtables ((void (*)())0, prune_vtable_vardecl); + walk_vtables ((void (*) PROTO((tree, tree))) 0, + prune_vtable_vardecl); for (vars = getdecls (); vars; vars = TREE_CHAIN (vars)) { diff --git a/gcc/cp/error.c b/gcc/cp/error.c index ea675f346ee..cc7908c5556 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -86,10 +86,24 @@ static char *scratch_firstobj; # define NEXT_CODE(t) (TREE_CODE (TREE_TYPE (t))) -static void dump_type (), dump_decl (), dump_function_decl (); -static void dump_expr (), dump_unary_op (), dump_binary_op (); -static void dump_aggr_type (), dump_type_prefix (), dump_type_suffix (); -static void dump_function_name (); +enum pad { none, before, after }; + +static void dump_type PROTO((tree, int)); +static void dump_decl PROTO((tree, int)); +static void dump_function_decl PROTO((tree, int)); +static void dump_expr PROTO((tree, int)); +static void dump_unary_op PROTO((char *, tree, int)); +static void dump_binary_op PROTO((char *, tree)); +static void dump_aggr_type PROTO((tree, int)); +static void dump_type_prefix PROTO((tree, int)); +static void dump_type_suffix PROTO((tree, int)); +static void dump_function_name PROTO((tree)); +static void dump_expr_list PROTO((tree)); +static void dump_global_iord PROTO((tree)); +static void dump_readonly_or_volatile PROTO((tree, enum pad)); +static void dump_char PROTO((char)); +static char *aggr_variety PROTO((tree)); +static tree ident_fndecl PROTO((tree)); void init_error () @@ -98,8 +112,6 @@ init_error () scratch_firstobj = (char *)obstack_alloc (&scratch_obstack, 0); } -enum pad { none, before, after }; - static void dump_readonly_or_volatile (t, p) tree t; @@ -154,7 +166,7 @@ dump_type (t, v) if (TREE_PURPOSE (t) && v) { OB_PUTS (" = "); - dump_expr (TREE_PURPOSE (t)); + dump_expr (TREE_PURPOSE (t), 0); } if (TREE_CHAIN (t)) { @@ -183,7 +195,7 @@ dump_type (t, v) && (IS_SIGNATURE_POINTER (t) || IS_SIGNATURE_REFERENCE (t))) { if (TYPE_READONLY (t) | TYPE_VOLATILE (t)) - dump_readonly_or_volatile (t); + dump_readonly_or_volatile (t, after); dump_type (SIGNATURE_TYPE (t), v); if (IS_SIGNATURE_POINTER (t)) OB_PUTC ('*'); @@ -535,7 +547,7 @@ dump_type_suffix (t, v) /* Return a function declaration which corresponds to the IDENTIFIER_NODE argument. */ -tree +static tree ident_fndecl (t) tree t; { @@ -567,7 +579,7 @@ ident_fndecl (t) #define GLOBAL_IORD_P(NODE) \ ! strncmp (IDENTIFIER_POINTER(NODE), GLOBAL_THING, sizeof (GLOBAL_THING) - 1) -void +static void dump_global_iord (t) tree t; { @@ -1280,7 +1292,7 @@ dump_expr (t, nop) if (integer_all_onesp (idx)) { tree pfn = PFN_FROM_PTRMEMFUNC (t); - dump_expr (pfn); + dump_expr (pfn, 0); break; } if (TREE_CODE (idx) == INTEGER_CST @@ -1306,7 +1318,7 @@ dump_expr (t, nop) } if (virtuals) { - dump_expr (FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (virtuals))); + dump_expr (FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (virtuals)), 0); break; } } diff --git a/gcc/cp/except.c b/gcc/cp/except.c index a5d82358571..a5849f0d26b 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -44,6 +44,13 @@ tree builtin_return_address_fndecl; /* Used to cache a call to __builtin_return_address. */ static tree BuiltinReturnAddress; +static void easy_expand_asm PROTO((char *)); +static void push_eh_cleanup PROTO((void)); +static void do_unwind PROTO((rtx)); +static rtx do_function_call PROTO((tree, tree, tree)); +static tree build_eh_type_type PROTO((tree)); +static tree build_eh_type PROTO((tree)); +static void expand_end_eh_spec PROTO((tree)); static void easy_expand_asm (str) @@ -156,9 +163,6 @@ asm (TEXT_SECTION_ASM_OP); ===================================================================== */ -extern rtx emit_insn PROTO((rtx)); -extern rtx gen_nop PROTO(()); - /* local globals for function calls ====================================================================== */ @@ -230,7 +234,6 @@ do_function_call (func, params, return_type) void init_exception_processing () { - extern tree define_function (); tree unexpected_fndecl, terminate_fndecl; tree set_unexpected_fndecl, set_terminate_fndecl; tree catch_match_fndecl; diff --git a/gcc/cp/expr.c b/gcc/cp/expr.c index fdc78155169..1967b76ea44 100644 --- a/gcc/cp/expr.c +++ b/gcc/cp/expr.c @@ -28,6 +28,9 @@ Boston, MA 02111-1307, USA. */ #include "expr.h" #include "cp-tree.h" +static tree extract_aggr_init PROTO((tree, tree)); +static tree extract_scalar_init PROTO((tree, tree)); + /* Hook used by expand_expr to expand language-specific tree codes. */ rtx diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c index 26528862d0c..f73ed97e3c7 100644 --- a/gcc/cp/friend.c +++ b/gcc/cp/friend.c @@ -26,6 +26,13 @@ Boston, MA 02111-1307, USA. */ #include "flags.h" #include "output.h" +#ifdef HAVE_STRING_H +#include <string.h> +#endif + +static void add_friend PROTO((tree, tree)); +static void add_friends PROTO((tree, tree, tree)); + /* Friend data structures: Lists of friend functions come from TYPE_DECL nodes. Since all diff --git a/gcc/cp/g++spec.c b/gcc/cp/g++spec.c index 126e1c4d467..beb8c570f96 100644 --- a/gcc/cp/g++spec.c +++ b/gcc/cp/g++spec.c @@ -5,6 +5,14 @@ #include "gansidecl.h" +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#endif + +#ifdef HAVE_STRING_H +#include <string.h> +#endif + /* This bit is set if we saw a `-xfoo' language specification. */ #define LANGSPEC (1<<1) /* This bit is set if they did `-lm' or `-lmath'. */ diff --git a/gcc/cp/init.c b/gcc/cp/init.c index a1cff1a5e09..1f032e07c13 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -30,6 +30,8 @@ Boston, MA 02111-1307, USA. */ #include "output.h" #include "except.h" +extern void compiler_error (); + /* In C++, structures with well-defined constructors are initialized by those constructors, unasked. CURRENT_BASE_INIT_LIST holds a list of stmts for a BASE_INIT term in the grammar. @@ -41,15 +43,23 @@ Boston, MA 02111-1307, USA. */ line. Perhaps this was not intended. */ tree current_base_init_list, current_member_init_list; -void emit_base_init (); -void check_base_init (); -static void expand_aggr_vbase_init (); -void expand_member_init (); -void expand_aggr_init (); - -static void expand_aggr_init_1 PROTO((tree, tree, tree, tree, int, int)); +static void expand_aggr_vbase_init_1 PROTO((tree, tree, tree, tree)); +static void expand_aggr_vbase_init PROTO((tree, tree, tree, tree)); +static void expand_aggr_init_1 PROTO((tree, tree, tree, tree, int, + int)); +static void expand_default_init PROTO((tree, tree, tree, tree, int, + int)); +static tree build_vec_delete_1 PROTO((tree, tree, tree, tree, tree, + int)); +static void perform_member_init PROTO((tree, tree, tree, int)); +static void sort_base_init PROTO((tree, tree *, tree *)); +static tree build_builtin_call PROTO((tree, tree, tree)); +static tree build_array_eh_cleanup PROTO((tree, tree, tree)); +static int member_init_ok_or_else PROTO((tree, tree, char *)); static void expand_virtual_init PROTO((tree, tree)); -tree expand_vec_init (); +static tree sort_member_init PROTO((tree)); +static tree build_partial_cleanup_for PROTO((tree)); +static tree initializing_context PROTO((tree)); /* Cache _builtin_new and _builtin_delete exprs. */ static tree BIN, BID, BIVN, BIVD; diff --git a/gcc/cp/input.c b/gcc/cp/input.c index 923f27c9591..e884ed2ebb8 100644 --- a/gcc/cp/input.c +++ b/gcc/cp/input.c @@ -33,9 +33,6 @@ Boston, MA 02111-1307, USA. */ extern FILE *finput; -struct pending_input *save_pending_input (); -void restore_pending_input (); - struct input_source { /* saved string */ char *str; @@ -62,6 +59,17 @@ extern int lineno; #define inline #endif +extern void feed_input PROTO((char *, int)); +extern void put_input PROTO((int)); +extern void put_back PROTO((int)); +extern int getch PROTO((void)); +extern int input_redirected PROTO((void)); + +static inline struct input_source * allocate_input PROTO((void)); +static inline void free_input PROTO((struct input_source *)); +static inline void end_input PROTO((void)); +static inline int sub_getch PROTO((void)); + static inline struct input_source * allocate_input () { diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 2c4b5234074..b2b0c504d28 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -44,6 +44,21 @@ Boston, MA 02111-1307, USA. */ #include <locale.h> #endif +#ifdef HAVE_STDLIB_H +#ifndef MULTIBYTE_CHARS +#include <stdlib.h> +#endif +#else +extern double atof (); +#endif + +#ifdef HAVE_STRING_H +#include <string.h> +#else +extern char *index (); +extern char *rindex (); +#endif + #ifndef errno extern int errno; /* needed for VAX. */ #endif @@ -54,9 +69,27 @@ extern int errno; /* needed for VAX. */ extern struct obstack permanent_obstack; extern struct obstack *current_obstack, *saveable_obstack; -extern double atof (); - -extern char *get_directive_line (); /* In c-common.c */ +extern void yyprint PROTO((FILE *, int, YYSTYPE)); +extern void set_float_handler PROTO((jmp_buf)); +extern void compiler_error PROTO((char *, HOST_WIDE_INT, + HOST_WIDE_INT)); + +static tree get_time_identifier PROTO((char *)); +static int check_newline PROTO((void)); +static int skip_white_space PROTO((int)); +static int yynextch PROTO((void)); +static void finish_defarg PROTO((void)); +static int my_get_run_time PROTO((void)); +static int get_last_nonwhite_on_line PROTO((void)); +static int interface_strcmp PROTO((char *)); +static int readescape PROTO((int *)); +static char *extend_token_buffer PROTO((char *)); +static void consume_string PROTO((struct obstack *, int)); +static void set_typedecl_interface_info PROTO((tree, tree)); +static void feed_defarg PROTO((tree, tree)); +static int set_vardecl_interface_info PROTO((tree, tree)); +static void store_pending_inline PROTO((tree, struct pending_inline *)); +static void reinit_parse_for_expr PROTO((struct obstack *)); /* Given a file name X, return the nondirectory portion. Keep in mind that X can be computed more than once. */ @@ -65,10 +98,6 @@ extern char *get_directive_line (); /* In c-common.c */ (rindex (X, '/') != 0 ? rindex (X, '/') + 1 : X) #endif -extern char *index (); -extern char *rindex (); -void yyerror (); - /* This obstack is needed to hold text. It is not safe to use TOKEN_BUFFER because `check_newline' calls `yylex'. */ struct obstack inline_text_obstack; @@ -123,7 +152,6 @@ tree ridpointers[(int) RID_MAX]; /* We may keep statistics about how long which files took to compile. */ static int header_time, body_time; -static tree get_time_identifier (); static tree filename_times; static tree this_filename_time; @@ -272,13 +300,10 @@ char *token_buffer; /* Pointer to token buffer. #include "hash.h" -static int check_newline (); /* Nonzero tells yylex to ignore \ in string constants. */ static int ignore_escape_flag = 0; -static int skip_white_space (); - static tree get_time_identifier (name) char *name; @@ -402,12 +427,9 @@ reinit_lang_specific () } #endif -int *init_parse (); - void init_lex () { - extern char *(*decl_printable_name) (); extern int flag_no_gnu_keywords; extern int flag_operator_names; @@ -1414,8 +1436,6 @@ store_pending_inline (decl, t) pending_inlines = t; } -static void reinit_parse_for_block PROTO((int, struct obstack *)); - void reinit_parse_for_method (yychar, decl) int yychar; @@ -1465,7 +1485,7 @@ reinit_parse_for_method (yychar, decl) /* Consume a block -- actually, a method beginning with `:' or `{' -- and save it away on the specified obstack. */ -static void +void reinit_parse_for_block (pyychar, obstackp) int pyychar; struct obstack *obstackp; @@ -2159,9 +2179,9 @@ get_last_nonwhite_on_line () int linemode; #ifdef HANDLE_SYSV_PRAGMA -static int handle_sysv_pragma (); +static int handle_sysv_pragma PROTO((FILE *, int)); #endif -static int handle_cp_pragma (); +static int handle_cp_pragma PROTO((char *)); static int check_newline () @@ -2691,7 +2711,6 @@ readescape (ignore_ptr) int looking_for_typename = 0; #ifdef __GNUC__ -extern __inline int identifier_type (); __inline #endif int @@ -3122,7 +3141,7 @@ real_yylex () p = extend_token_buffer (p); *p++ = c; - c = getch (finput); + c = getc (finput); } if (linemode && c == '\n') @@ -3633,7 +3652,7 @@ real_yylex () p = extend_token_buffer (p); *p++ = c; *p = 0; - c = getch (finput); + c = getc (finput); } /* The second argument, machine_mode, of REAL_VALUE_ATOF @@ -3741,7 +3760,7 @@ real_yylex () if (p >= token_buffer + maxtoken - 3) p = extend_token_buffer (p); *p++ = c; - c = getch (finput); + c = getc (finput); } /* If the constant is not long long and it won't fit in an diff --git a/gcc/cp/lex.h b/gcc/cp/lex.h index fcea57af7a4..8df6b76a270 100644 --- a/gcc/cp/lex.h +++ b/gcc/cp/lex.h @@ -132,7 +132,4 @@ extern tree got_object; Positive is push count, negative is pop count. */ extern int pending_lang_change; -extern tree make_pointer_declarator (), make_reference_declarator (); -extern void reinit_parse_for_function (); -extern void reinit_parse_for_method (); -extern int yylex (); +extern int yylex PROTO((void)); diff --git a/gcc/cp/method.c b/gcc/cp/method.c index a0e9d9610ae..24026e79328 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -39,6 +39,12 @@ Boston, MA 02111-1307, USA. */ #include "hard-reg-set.h" #include "flags.h" +#ifdef HAVE_STRING_H +#include <string.h> +#else +extern char *index (); +#endif + /* TREE_LIST of the current inline functions that need to be processed. */ struct pending_inline *pending_inlines; @@ -52,6 +58,20 @@ int static_labelno; static struct obstack scratch_obstack; static char *scratch_firstobj; +static void icat PROTO((HOST_WIDE_INT)); +static void dicat PROTO((HOST_WIDE_INT, HOST_WIDE_INT)); +static void flush_repeats PROTO((tree)); +static void build_overload_identifier PROTO((tree)); +static void build_overload_nested_name PROTO((tree)); +static void build_overload_int PROTO((tree)); +static void build_overload_identifier PROTO((tree)); +static void build_qualified_name PROTO((tree)); +static void build_overload_value PROTO((tree, tree)); +static char *thunk_printable_name PROTO((tree)); +static void do_build_assign_ref PROTO((tree)); +static void do_build_copy_constructor PROTO((tree)); +static tree largest_union_member PROTO((tree)); + # define OB_INIT() (scratch_firstobj ? (obstack_free (&scratch_obstack, scratch_firstobj), 0) : 0) # define OB_PUTC(C) (obstack_1grow (&scratch_obstack, (C))) # define OB_PUTC2(C1,C2) \ @@ -355,7 +375,6 @@ flush_repeats (type) } static int numeric_output_need_bar; -static void build_overload_identifier (); static void build_overload_nested_name (decl) @@ -477,7 +496,6 @@ build_overload_value (type, value) { REAL_VALUE_TYPE val; char *bufp = digit_buffer; - extern char *index (); pedwarn ("ANSI C++ forbids floating-point template arguments"); diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y index 3b403364608..1554259877c 100644 --- a/gcc/cp/parse.y +++ b/gcc/cp/parse.y @@ -41,6 +41,7 @@ Boston, MA 02111-1307, USA. */ #include "lex.h" #include "cp-tree.h" #include "output.h" +#include "except.h" /* Since parsers are distinct for each language, put the language string definition here. (fnf) */ @@ -61,8 +62,6 @@ extern tree last_tree; extern tree strip_attrs PROTO((tree)); /* END FSF LOCAL */ -void yyerror (); - /* Like YYERROR but do call yyerror. */ #define YYERROR1 { yyerror ("syntax error"); YYERROR; } @@ -73,12 +72,12 @@ void yyerror (); error message if the user supplies an empty conditional expression. */ static char *cond_stmt_keyword; +static tree empty_parms PROTO((void)); + /* Nonzero if we have an `extern "C"' acting as an extern specifier. */ int have_extern_spec; int used_extern_spec; -void yyhook (); - /* Cons up an empty parameter list. */ #ifdef __GNUC__ __inline @@ -301,7 +300,7 @@ static tree current_aggr; /* Tell yyparse how to print a token's value, if yydebug is set. */ #define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL) -extern void yyprint (); +extern void yyprint PROTO((FILE *, int, YYSTYPE)); extern tree combine_strings PROTO((tree)); %} @@ -2215,7 +2214,7 @@ structsp: if (! semi) check_for_missing_semicolon ($1); if (current_scope () == current_function_decl) - do_pending_defargs ($1); + do_pending_defargs (); } pending_defargs { diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index e13b19de900..31007ec84ec 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -40,6 +40,11 @@ Boston, MA 02111-1307, USA. */ #include "lex.h" #include "output.h" #include "defaults.h" +#include "except.h" + +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#endif extern struct obstack permanent_obstack; @@ -61,18 +66,17 @@ int minimal_parse_mode; #define obstack_chunk_alloc xmalloc #define obstack_chunk_free free -static int unify (); - -void pop_template_decls (); - -static tree classtype_mangled_name (); -static char * mangle_class_name_for_template (); -static tree tsubst_expr_values (); +static int unify PROTO((tree, tree *, int, tree, tree, int *, int)); +static void add_pending_template PROTO((tree)); +static int push_tinst_level PROTO((tree)); +static tree classtype_mangled_name PROTO((tree)); +static char *mangle_class_name_for_template PROTO((char *, tree, tree)); +static tree tsubst_expr_values PROTO((tree, tree)); static int comp_template_args PROTO((tree, tree)); -tree most_specialized_class PROTO((tree, tree)); +static int list_eq PROTO((tree, tree)); static tree get_class_bindings PROTO((tree, tree, tree)); -tree make_temp_vec PROTO((int)); -static tree tsubst_enum PROTO((tree, tree *, int)); +static tree coerce_template_parms PROTO((tree, tree, tree)); +static tree tsubst_enum PROTO((tree, tree *, int)); /* We've got a template header coming up; push to a new level for storing the parms. */ diff --git a/gcc/cp/repo.c b/gcc/cp/repo.c index b979da78b2c..001a9430965 100644 --- a/gcc/cp/repo.c +++ b/gcc/cp/repo.c @@ -32,9 +32,25 @@ Boston, MA 02111-1307, USA. */ #include "input.h" #include "obstack.h" +#ifdef HAVE_STRING_H +#include <string.h> +#else extern char * rindex (); +#endif +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#else extern char * getenv (); -extern char * getpwd (); +#endif +extern char * getpwd PROTO((void)); + +static tree repo_get_id PROTO((tree)); +static char *save_string PROTO((char *, int)); +static char *extract_string PROTO((char **)); +static char *get_base_filename PROTO((char *)); +static void open_repo_file PROTO((char *)); +static char *afgets PROTO((FILE *)); +static void reopen_repo_file_for_write PROTO((void)); static tree pending_repo; static tree original_repo; diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 4019eb14e16..dd82e34335f 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -32,10 +32,23 @@ Boston, MA 02111-1307, USA. */ #define INT_TYPE_SIZE BITS_PER_WORD #endif -extern tree define_function (); -extern tree build_t_desc_overload (); extern struct obstack permanent_obstack; +static tree call_void_fn PROTO((char *)); +static tree build_headof_sub PROTO((tree)); +static tree build_headof PROTO((tree)); +static tree get_tinfo_var PROTO((tree)); +static tree get_typeid_1 PROTO((tree)); +static tree ifnonnull PROTO((tree, tree)); +static tree build_dynamic_cast_1 PROTO((tree, tree)); +static void expand_si_desc PROTO((tree, tree)); +static void expand_class_desc PROTO((tree, tree)); +static void expand_attr_desc PROTO((tree, tree)); +static void expand_ptr_desc PROTO((tree, tree)); +static void expand_generic_desc PROTO((tree, tree, char *)); +static tree throw_bad_cast PROTO((void)); +static tree throw_bad_typeid PROTO((void)); + tree type_info_type_node; tree tinfo_fn_id; tree tinfo_fn_type; diff --git a/gcc/cp/search.c b/gcc/cp/search.c index 40a83c125da..29f8ef34519 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -75,12 +75,69 @@ pop_stack_level (stack) #define search_level stack_level static struct search_level *search_stack; -static tree lookup_field_1 (); +static void clear_memoized_cache PROTO((void)); +static tree make_memoized_table_entry PROTO((tree, tree, int)); +static tree get_abstract_virtuals_1 PROTO((tree, int, tree)); +static tree get_vbase_1 PROTO((tree, tree, unsigned int *)); +static tree convert_pointer_to_vbase PROTO((tree, tree)); +static tree lookup_field_1 PROTO((tree, tree)); +static tree convert_pointer_to_single_level PROTO((tree, tree)); static int lookup_fnfields_1 PROTO((tree, tree)); -static void dfs_walk (); -static int markedp (); -static void dfs_unmark (); -static void dfs_init_vbase_pointers (); +static int lookup_fnfields_here PROTO((tree, tree)); +static int is_subobject_of_p PROTO((tree, tree)); +static int hides PROTO((tree, tree)); +static tree virtual_context PROTO((tree, tree, tree)); +static tree get_template_base_recursive + PROTO((tree, tree, tree, int)); +static void dfs_walk PROTO((tree, void (*) (tree), int (*) (tree))); +static void envelope_add_decl PROTO((tree, tree, tree *)); +static int get_base_distance_recursive + PROTO((tree, int, int, int, int *, tree *, tree, tree *, + int, int *, int, int)); +static void expand_upcast_fixups + PROTO((tree, tree, tree, tree, tree, tree, tree *)); +static void fixup_virtual_upcast_offsets + PROTO((tree, tree, int, int, tree, tree, tree, tree, + tree *)); +static int markedp PROTO((tree)); +static int unmarkedp PROTO((tree)); +static int numberedp PROTO((tree)); +static int unnumberedp PROTO((tree)); +static int marked_vtable_pathp PROTO((tree)); +static int unmarked_vtable_pathp PROTO((tree)); +static int marked_new_vtablep PROTO((tree)); +static int unmarked_new_vtablep PROTO((tree)); +static int dfs_debug_unmarkedp PROTO((tree)); +static void dfs_number PROTO((tree)); +static void dfs_unnumber PROTO((tree)); +static void dfs_debug_mark PROTO((tree)); +static void dfs_find_vbases PROTO((tree)); +static void dfs_clear_vbase_slots PROTO((tree)); +static void dfs_unmark PROTO((tree)); +static void dfs_init_vbase_pointers PROTO((tree)); +static void dfs_get_vbase_types PROTO((tree)); +static void dfs_record_inheritance PROTO((tree)); +static void dfs_pushdecls PROTO((tree)); +static void dfs_compress_decls PROTO((tree)); +static void dfs_unuse_fields PROTO((tree)); +static void add_conversions PROTO((tree)); +static tree get_virtuals_named_this PROTO((tree)); +static tree get_virtual_destructor PROTO((tree, int)); +static int tree_has_any_destructor_p PROTO((tree, int)); +static struct search_level *push_search_level + PROTO((struct stack_level *, struct obstack *)); +static struct search_level *pop_search_level + PROTO((struct stack_level *)); +static struct type_level *push_type_level + PROTO((struct stack_level *, struct obstack *)); +static struct type_level *pop_type_level + PROTO((struct type_level *)); +static tree my_tree_cons PROTO((tree, tree, tree)); +static tree my_build_string PROTO((char *)); +static struct memoized_entry * my_new_memoized_entry + PROTO((struct memoized_entry *)); +static HOST_WIDE_INT breadth_first_search + PROTO((tree, int (*) (tree, int), int (*) (tree, int))); static tree vbase_types; static tree vbase_decl_ptr_intermediate, vbase_decl_ptr; @@ -136,7 +193,6 @@ static tree _vptr_name; /* Make things that look like tree nodes, but allocate them on type_obstack_entries. */ static int my_tree_node_counter; -static tree my_tree_cons (), my_build_string (); extern int flag_memoize_lookups, flag_save_memoized_contexts; @@ -1919,8 +1975,8 @@ lookup_fnfields (basetype_path, name, complain) static HOST_WIDE_INT breadth_first_search (binfo, testfn, qfn) tree binfo; - int (*testfn)(); - int (*qfn)(); + int (*testfn) PROTO((tree, int)); + int (*qfn) PROTO((tree, int)); { int head = 0, tail = 0; int rval = 0; @@ -1978,8 +2034,7 @@ breadth_first_search (binfo, testfn, qfn) } /* Functions to use in breadth first searches. */ -typedef tree (*pft)(); -typedef int (*pfi)(); +typedef int (*pfi) PROTO((tree, int)); static tree declarator; @@ -2383,8 +2438,8 @@ convert_pointer_to_single_level (to_type, expr) static void dfs_walk (binfo, fn, qfn) tree binfo; - void (*fn)(); - int (*qfn)(); + void (*fn) PROTO((tree)); + int (*qfn) PROTO((tree)); { tree binfos = BINFO_BASETYPES (binfo); int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0; diff --git a/gcc/cp/sig.c b/gcc/cp/sig.c index c52b1d62cd6..ba3af425384 100644 --- a/gcc/cp/sig.c +++ b/gcc/cp/sig.c @@ -32,12 +32,22 @@ extern struct obstack *current_obstack; extern struct obstack permanent_obstack; extern struct obstack *saveable_obstack; -extern void error (); -extern void sorry (); extern void compiler_error (); -extern void make_decl_rtl PROTO((tree, char *, int)); -static tree build_sptr_ref PROTO((tree)); +static tree save_this PROTO((tree)); +static tree build_sptr_ref PROTO((tree)); +static tree build_member_function_pointer PROTO((tree)); +static void undo_casts PROTO((tree)); +static tree build_signature_pointer_or_reference_name + PROTO((tree, int, int, int)); +static void build_signature_pointer_or_reference_decl + PROTO((tree, tree)); +static tree build_signature_pointer_or_reference_type + PROTO((tree, int, int, int)); +static tree get_sigtable_name PROTO((tree, tree)); +static tree build_signature_table_constructor PROTO((tree, tree)); +static int match_method_types PROTO((tree, tree)); +static tree build_sigtable PROTO((tree, tree, tree)); /* Used to help generate globally unique names for signature tables. */ diff --git a/gcc/cp/spew.c b/gcc/cp/spew.c index 15a1aa9f1a7..c82f1ecf55d 100644 --- a/gcc/cp/spew.c +++ b/gcc/cp/spew.c @@ -45,7 +45,9 @@ struct token { YYSTYPE yylval; }; -static int do_aggr (); +static int do_aggr PROTO((void)); +static int probe_obstack PROTO((struct obstack *, tree, unsigned int)); +static void scan_tokens PROTO((int)); /* From lex.c: */ /* the declaration found for the last IDENTIFIER token read in. @@ -228,8 +230,6 @@ peekyylex () return nth_token (0)->yychar; } -extern tree snarf_defarg (); - int yylex () { diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 2843abdd250..e12050ddd30 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -32,6 +32,17 @@ Boston, MA 02111-1307, USA. */ #include <varargs.h> #endif +extern void compiler_error (); + +static tree get_identifier_list PROTO((tree)); +static tree bot_manip PROTO((tree)); +static tree perm_manip PROTO((tree)); +static tree build_cplus_array_type_1 PROTO((tree, tree)); +static void list_hash_add PROTO((int, tree)); +static int list_hash PROTO((tree, tree, tree)); +static tree list_hash_lookup PROTO((int, int, int, int, tree, tree, + tree)); + #define CEIL(x,y) (((x) + (y) - 1) / (y)) /* Return nonzero if REF is an lvalue valid for this language. @@ -1291,25 +1302,6 @@ is_aggr_type_2 (t1, t2) return 0; return IS_AGGR_TYPE (t1) && IS_AGGR_TYPE (t2); } - -/* Give message using types TYPE1 and TYPE2 as arguments. - PFN is the function which will print the message; - S is the format string for PFN to use. */ - -void -message_2_types (pfn, s, type1, type2) - void (*pfn) (); - char *s; - tree type1, type2; -{ - tree name1 = TYPE_NAME (type1); - tree name2 = TYPE_NAME (type2); - if (TREE_CODE (name1) == TYPE_DECL) - name1 = DECL_NAME (name1); - if (TREE_CODE (name2) == TYPE_DECL) - name2 = DECL_NAME (name2); - (*pfn) (s, IDENTIFIER_POINTER (name1), IDENTIFIER_POINTER (name2)); -} #define PRINT_RING_SIZE 4 @@ -1406,7 +1398,7 @@ build_exception_variant (type, raises) tree mapcar (t, func) tree t; - tree (*func)(); + tree (*func) PROTO((tree)); { tree tmp; diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 0be5b08b9f5..3350a9295b1 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -29,9 +29,6 @@ Boston, MA 02111-1307, USA. */ and to process initializations in declarations (since they work like a strange sort of assignment). */ -extern void error (); -extern void warning (); - #include "config.h" #include <stdio.h> #include "tree.h" @@ -40,19 +37,29 @@ extern void warning (); #include "flags.h" #include "output.h" -int mark_addressable PROTO((tree)); -static tree convert_for_assignment PROTO((tree, tree, char*, tree, int)); -/* static */ tree convert_for_initialization PROTO((tree, tree, tree, int, char*, tree, int)); -extern tree shorten_compare (); -static tree pointer_int_sum PROTO((enum tree_code, register tree, register tree)); -static tree pointer_diff PROTO((register tree, register tree)); +#ifdef HAVE_STRING_H +#include <string.h> +#endif + +extern void compiler_error (); + +static tree convert_for_assignment PROTO((tree, tree, char*, tree, + int)); +static tree pointer_int_sum PROTO((enum tree_code, tree, tree)); +static tree rationalize_conditional_expr PROTO((enum tree_code, tree)); static int comp_target_parms PROTO((tree, tree, int)); +static int comp_ptr_ttypes_real PROTO((tree, tree, int)); static int comp_ptr_ttypes_const PROTO((tree, tree)); static int comp_ptr_ttypes_reinterpret PROTO((tree, tree)); -#if 0 -static tree convert_sequence (); -#endif -/* static */ tree unary_complex_lvalue PROTO((enum tree_code, tree)); +static int comp_array_types PROTO((int (*) (tree, tree, int), tree, + tree, int)); +static tree build_ptrmemfunc1 PROTO((tree, tree, tree, tree, tree)); +static tree common_base_type PROTO((tree, tree)); +static tree convert_sequence PROTO((tree, tree)); +static tree lookup_anon_field PROTO((tree, tree)); +static tree pointer_diff PROTO((tree, tree)); +static tree qualify_type PROTO((tree, tree)); +static tree expand_target_expr PROTO((tree)); static tree get_delta_difference PROTO((tree, tree, int)); /* Return the target type of TYPE, which meas return T for: @@ -589,7 +596,7 @@ compexcepttypes (t1, t2) static int comp_array_types (cmp, t1, t2, strict) - register int (*cmp)(); + register int (*cmp) PROTO((tree, tree, int)); tree t1, t2; int strict; { @@ -6254,14 +6261,14 @@ build_ptrmemfunc1 (type, delta, idx, pfn, delta2) if (pfn) { allconstant = TREE_CONSTANT (pfn); - allsimple = initializer_constant_valid_p (pfn, TREE_TYPE (pfn)); + allsimple = (int) initializer_constant_valid_p (pfn, TREE_TYPE (pfn)); u = tree_cons (pfn_field, pfn, NULL_TREE); } else { delta2 = convert_and_check (delta_type_node, delta2); allconstant = TREE_CONSTANT (delta2); - allsimple = initializer_constant_valid_p (delta2, TREE_TYPE (delta2)); + allsimple = (int) initializer_constant_valid_p (delta2, TREE_TYPE (delta2)); u = tree_cons (delta2_field, delta2, NULL_TREE); } diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 93b80967aaa..b03cb5da1ab 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -36,8 +36,7 @@ Boston, MA 02111-1307, USA. */ #include "cp-tree.h" #include "flags.h" -static tree process_init_constructor (); -extern void pedwarn (), error (); +static tree process_init_constructor PROTO((tree, tree, tree *)); extern int errorcount; extern int sorrycount; diff --git a/gcc/cp/xref.c b/gcc/cp/xref.c index 260ddd2d003..fc2d1078ac2 100644 --- a/gcc/cp/xref.c +++ b/gcc/cp/xref.c @@ -28,10 +28,22 @@ Boston, MA 02111-1307, USA. */ #include <ctype.h> -extern char *getpwd (); +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#endif + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +extern char *getpwd PROTO((void)); +#ifdef HAVE_STRING_H +#include <string.h> +#else extern char *index (); extern char *rindex (); +#endif /* The character(s) used to join a directory specification (obtained with getwd or equivalent) with a non-absolute file name. */ @@ -125,30 +137,14 @@ static tree last_fndecl = NULL; /* Forward definitions */ /* */ /************************************************************************/ - -extern void GNU_xref_begin(); -extern void GNU_xref_end(); -extern void GNU_xref_file(); -extern void GNU_xref_start_scope(); -extern void GNU_xref_end_scope(); -extern void GNU_xref_ref(); -extern void GNU_xref_decl(); -extern void GNU_xref_call(); -extern void GNU_xref_function(); -extern void GNU_xref_assign(); -extern void GNU_xref_hier(); -extern void GNU_xref_member(); - -static void gen_assign(); -static XREF_FILE find_file(); -static char * filename(); -static char * fctname(); -static char * declname(); -static void simplify_type(); -static char * fixname(); -static void open_xref_file(); - -extern char * type_as_string(); +static void gen_assign PROTO((XREF_FILE, tree)); +static XREF_FILE find_file PROTO((char *)); +static char * filename PROTO((XREF_FILE)); +static char * fctname PROTO((tree)); +static char * declname PROTO((tree)); +static void simplify_type PROTO((char *)); +static char * fixname PROTO((char *, char *)); +static void open_xref_file PROTO((char *)); /* Start cross referencing. FILE is the name of the file we xref. */ |