1995-04-03 21:28:01 +02:00
|
|
|
/* Code to maintain a C++ template repository.
|
2000-02-26 21:16:12 +01:00
|
|
|
Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
|
1995-04-03 21:28:01 +02:00
|
|
|
Contributed by Jason Merrill (jason@cygnus.com)
|
|
|
|
|
|
|
|
This file is part of GNU CC.
|
|
|
|
|
|
|
|
GNU CC is free software; you can redistribute it and/or modify
|
|
|
|
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.
|
|
|
|
|
|
|
|
GNU CC is distributed in the hope that it will be useful,
|
|
|
|
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 GNU CC; see the file COPYING. If not, write to
|
1995-06-15 14:29:51 +02:00
|
|
|
the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA. */
|
1995-04-03 21:28:01 +02:00
|
|
|
|
|
|
|
/* My strategy here is as follows:
|
|
|
|
|
|
|
|
Everything should be emitted in a translation unit where it is used.
|
|
|
|
The results of the automatic process should be easily reproducible with
|
1995-04-04 19:51:34 +02:00
|
|
|
explicit code. */
|
1995-04-03 21:28:01 +02:00
|
|
|
|
1995-04-04 19:51:34 +02:00
|
|
|
#include "config.h"
|
call.c: Include system.h.
* call.c: Include system.h. Remove includes, declarations and
defines provided by system.h.
* class.c, cvt.c, decl.c, decl2.c, errfn.c error.c: Likewise.
* except.c, expr.c friend.c, g++spec.c, init.c, input.c: Likewise.
* lex.c, parse.y, pt.c, ptree.c repo.c rtti.c, search.c: Likewise.
* semantics.c, sig.c, spew.c, tree.c, typeck.c: Likewise.
* typeck2.c, xref.c: Likewise.
* Makefile.in: Dependencies updated as appropriate.
* Make-lang.in: Likewise.
system.h cutover from the cp subdir
From-SVN: r18917
1998-03-31 15:25:46 +02:00
|
|
|
#include "system.h"
|
1995-04-03 21:28:01 +02:00
|
|
|
#include "tree.h"
|
|
|
|
#include "cp-tree.h"
|
|
|
|
#include "input.h"
|
1995-04-09 13:41:24 +02:00
|
|
|
#include "obstack.h"
|
call.c, [...]: Add include of toplev.h.
Wed May 6 06:36:41 1998 Robert Lipe <robertl@dgii.com>
* cp/call.c, cp/class.c, cp/decl.c, cp/decl2.c,
cp/errfn.c, cp/error.c, cp/except.c, cp/expr.c,
cp/friend.c, cp/init.c, cp/lex.c, cp/method.c,
cp/pt.c, cp/repo.c, cp/rtti.c, cp/search.c,
cp/semantics.c, cp/sig.c, cp/tree.c, cp/typeck.c,
cp/typeck2.c, cp/xref.c: Add include of toplev.h.
From-SVN: r19565
1998-05-06 07:01:35 +02:00
|
|
|
#include "toplev.h"
|
Get ready for garbage collection.
* Makefile.in (CXX_TREE_H): Add varray.h
(lex.o): Depend on ggc.h.
(decl.o): Likewise.
(decl2.o): Likewise.
(method.o): Likewise.
(search.o): Likewise.
(pt.o): Likewise.
(repo.o): Likewise.
* class.c: Include ggc.h.
(current_class_name): Remove.
(current_class_type): Likewise.
(current_access_specifier): Likewise.
(previous_class_type): Likewise.
(previous_class_values): Likewise.
(class_cache_firstobj): Likewise.
(current_lang_base): Likewise.
(current_lang_stack): Likewise.
(current_lang_stacksize): Likewise.
(lang_name_c): Likewise.
(lang_name_cplusplus): Likewise.
(lang_name_java): Likewise.
(current_lang_name): Likewise.
(base_layout_decl): Likewise.
(access_default_node): Likewise.
(access_public_node): Likewise.
(access_protected_node): Likewise.
(access_private_node): Likewise.
(access_default_virtual_node): Likewise.
(access_public_virtual_node): Likewise.
(access_protected_virtual_node): Likewise.
(access_private_virtual_node): Likewise.
(signed_zero_node): Likewise.
(init_class_processing): Don't build base_layout_decl.
(push_lang_context): Adjust now that current_lang_base is a varray.
(pop_lang_context): Likewise.
* cp-tree.h: Include varray.h.
(cp_global_trees): Add access_default, access_public,
access_protected, access_private, access_default_virtual,
access_public_virtual, access_protected_virtual,
access_private_virtual, ctor_identifier, delta2_identifier,
delta_identifier, dtor_identifier, in_charge_identifier,
index_identifier, nelts_identifier, this_identifier,
pfn_identifier, pfn_or_delta2_identifier, vptr_identifier,
lang_name_c, lang_name_cplusplus, lang_name_java,
empty_except_spec, null, jclass, minus_one, terminate.
(saved_scope): Move here from decl.c. Define globals in terms of
saved_scope: current_namespace, current_class_name,
current_class_type, current_access_specifier, current_lang_stack,
current_lang_base, current_lang_name, current_function_parms,
current_template_parms, processing_template_decl,
processing_specialization, processing_explicit_instantiation,
previous_class_type, previous_class_values, class_cache_firstobj.
(scope_chain): New variable.
(init_pt): New function.
* decl.c (current_namespace): Remove.
(this_identifier, in_charge_identifier, ctor_identifier): Likewise.
(dtor_identifier, pfn_identifier, index_identifier): Likewise.
(delta_identifier, delta2_identifier): Likewise.
(pfn_or_delta2_identifier, tag_identifier): Likewise
(vt_off_identifier, empty_except_spec, null_node): Likewise.
(current_function_parms, current_lang_base): Remove.
(current_lang_stack, previous_class_values): Remove.
(class_binding_level): Macroize.
(saved_scope): Remove.
(current_saved_scope): Rename to scope_chain.
(mark_saved_scope): Adjust for new scope structure.
(maybe_push_to_top_level): Likewise.
(pop_from_top_level): Likewise.
(duplicate_decls): Adjust now that current_lang_base is a varray.
(build_typename_type): Call ggc_add_tree_hash_table_root.
(init_decl_processing): Call init_pt. Call push_to_top_level to
set up globals. Add GC roots.
(xref_basetypes): Adjust now that current_lang_base is a varray.
* decl.h (this_identifier): Remove.
(in_charge_identifier): Likewise.
* decl2.c: Don't include varray.h.
(current_namespace): Remove.
(init_decl2): Add GC roots.
* except.c (Terminate): Remove.
(init_exception_processing): Use terminate_node instead.
(build_terminate_handler): Likewise.
* init.c (nc_nelts_field_id): Remove.
(minus_one): Likewise.
(init_init_processing): Use minus_one_node and nelts_identifier
instead. Add GC roots.
(jclass_node): Remove.
(build_new_1): Use nelts_identifier.
(build_vec_init): Likewise.
(build_vec_delete): Likewise.
* lex.c: Include ggc.h.
(defarg_fn): Move declaration early.
(defarg_parms): Likewise.
(init_parse): Add GC roots.
(handle_cp_pragma): Remove redundant declaration of
pending_vtables.
* method.c: Include ggc.h.
(btypelist): Make it a varray. All uses changed.
(ktypelist): Likewise.
(init_method): Add GC roots.
* pt.c: Don't include varray.h. Include ggc.h.
(current_template_parms): Remove.
(processing_template_decl): Likewise.
(processing_specialization): Likewise.
(processing_explicit_instantiation): Likewise.
(init_pt): New function.
* repo.c: Include ggc.h.
(init_repo): Add GC roots.
* search.c: Don't include varray.h.
(_vptr_name): Remove.
(lookup_field_1): Use vtpr_identifier instead.
(expand_indirect_vtbls_init): Remove redundant declaration of
in_charge_identifier.
(init_search_processing): Use vptr_identifier.
From-SVN: r29135
1999-09-06 04:43:09 +02:00
|
|
|
#include "ggc.h"
|
1995-04-03 21:28:01 +02:00
|
|
|
|
2000-01-26 21:51:37 +01:00
|
|
|
static tree repo_get_id PARAMS ((tree));
|
|
|
|
static char *extract_string PARAMS ((char **));
|
|
|
|
static char *get_base_filename PARAMS ((const char *));
|
|
|
|
static void open_repo_file PARAMS ((const char *));
|
|
|
|
static char *afgets PARAMS ((FILE *));
|
|
|
|
static void reopen_repo_file_for_write PARAMS ((void));
|
1995-04-03 21:28:01 +02:00
|
|
|
|
|
|
|
static tree pending_repo;
|
1995-04-09 13:41:24 +02:00
|
|
|
static tree original_repo;
|
1995-04-24 19:27:46 +02:00
|
|
|
static char *repo_name;
|
1995-04-03 21:28:01 +02:00
|
|
|
static FILE *repo_file;
|
|
|
|
|
1997-06-18 04:25:37 +02:00
|
|
|
static char *old_args, *old_dir, *old_main;
|
|
|
|
|
1995-04-03 21:28:01 +02:00
|
|
|
extern int flag_use_repository;
|
1995-04-24 19:27:46 +02:00
|
|
|
extern struct obstack temporary_obstack;
|
|
|
|
extern struct obstack permanent_obstack;
|
1995-04-03 21:28:01 +02:00
|
|
|
|
|
|
|
#define IDENTIFIER_REPO_USED(NODE) (TREE_LANG_FLAG_3 (NODE))
|
|
|
|
#define IDENTIFIER_REPO_CHOSEN(NODE) (TREE_LANG_FLAG_4 (NODE))
|
|
|
|
|
1996-02-28 23:01:56 +01:00
|
|
|
#if 0
|
1995-04-03 21:28:01 +02:00
|
|
|
/* Record the flags used to compile this translation unit. */
|
|
|
|
|
|
|
|
void
|
|
|
|
repo_compile_flags (argc, argv)
|
|
|
|
int argc;
|
|
|
|
char **argv;
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If this template has not been seen before, add a note to the repository
|
|
|
|
saying where the declaration was. This may be used to find the
|
|
|
|
definition at link time. */
|
|
|
|
|
|
|
|
void
|
|
|
|
repo_template_declared (t)
|
|
|
|
tree t;
|
|
|
|
{}
|
|
|
|
|
|
|
|
/* Note where the definition of a template lives so that instantiations can
|
|
|
|
be generated later. */
|
|
|
|
|
|
|
|
void
|
|
|
|
repo_template_defined (t)
|
|
|
|
tree t;
|
|
|
|
{}
|
|
|
|
|
|
|
|
/* Note where the definition of a class lives to that template
|
|
|
|
instantiations can use it. */
|
|
|
|
|
|
|
|
void
|
|
|
|
repo_class_defined (t)
|
|
|
|
tree t;
|
|
|
|
{}
|
1996-02-28 23:01:56 +01:00
|
|
|
#endif
|
1995-04-03 21:28:01 +02:00
|
|
|
|
1996-02-28 23:01:56 +01:00
|
|
|
static tree
|
1995-04-18 21:23:38 +02:00
|
|
|
repo_get_id (t)
|
|
|
|
tree t;
|
|
|
|
{
|
builtin.c (get_pointer_alignment): Use DECL_P and TYPE_P macros.
* builtin.c (get_pointer_alignment): Use DECL_P and TYPE_P macros.
* c-common.c (decl_attributes,check_format_info,truthvalue_conversion,
c_get_alias_set): Likewise.
* c-decl.c (duplicate_decls): Likewise.
* c-typeck.c (default_conversion,build_unary_op): Likewise.
* calls.c (initialize_argument_information): Likewise.
* dwarf2out.c (decl_class_context,add_abstract_origin_attribute):
Likewise.
* dwarfout.c (decl_class_context,output_type): Likewise.
* expr.c (get_inner_reference): Likewise.
* fold-const.c (simple_operand_p,fold): Likewise.
* function.c (aggregate_value_p): Likewise.
* stmt.c (expand_asm_operands): Likewise.
* varasm.c (named_section): Likewise.
* call.c (check_dtor_name,build_new_method_call): Likewise.
* decl.c (push_class_binding,poplevel,pushtag,lookup_namespace_name,
make_typename_type,check_initializer,cp_finish_decl,xref_tag): Likewise.
* decl2.c (grokfield,build_expr_from_tree,build_expr_from_tree,
decl_namespace,arg_assoc_template_arg,arg_assoc,
validate_nonmember_using_decl,do_class_using_decl): Likewise.
* error.c (dump_template_argument,dump_expr,cp_file_of,cp_line_of,
args_to_string): Likewise.
* friend.c (is_friend): Likewise.
* lex.c (note_got_semicolon,note_list_got_semicolon,is_global): Likewise.
* method.c (build_overload_nested_name,build_overload_value,
build_qualified_name,build_qualified_name,hack_identifier): Likewise.
* parse.y (typename_sub,typename_sub1): Likewise.
* pt.c (push_inline_template_parms_recursive,check_template_shadow,
process_partial_specialization,convert_template_argument,
template_args_equal,add_pending_template,lookup_template_class,
for_each_template_parm_r,maybe_fold_nontype_arg,
tsubst,instantiate_template,type_unification_real,unify,
instantiate_pending_templates,set_mangled_name_for_template_decl):
Likewise.
* repo.c (repo_get_id,repo_template_used): Likewise.
* search.c (lookup_field_1): Likewise.
* tree.c (walk_tree,get_type_decl,cp_tree_equal,member_p): Likewise.
* xref.c (classname): Likewise.
From-SVN: r32698
2000-03-23 01:41:05 +01:00
|
|
|
if (TYPE_P (t))
|
1995-04-18 21:23:38 +02:00
|
|
|
{
|
2000-07-04 09:47:11 +02:00
|
|
|
tree vtable;
|
|
|
|
|
1998-11-15 20:24:43 +01:00
|
|
|
/* If we're not done setting up the class, we may not have set up
|
|
|
|
the vtable, so going ahead would give the wrong answer.
|
|
|
|
See g++.pt/instantiate4.C. */
|
tree.h (COMPLETE_TYPE_P): New macro.
gcc
* tree.h (COMPLETE_TYPE_P): New macro.
(COMPLETE_OR_VOID_TYPE_P): New macro.
(COMPLETE_OR_UNBOUND_ARRAY_TYPE_P): New macro.
* stor-layout.c (layout_type, case VOID_TYPE): Don't set TYPE_SIZE.
* c-aux-info.c (gen_type): Use them.
* c-common.c (c_expand_expr_stmt): Likewise.
* c-decl.c (poplevel, pushdecl, start_decl, finish_decl,
grokdeclarator, grokparms, finish_struct, start_function,
store_parm_decls, combine_parm_decls): Likewise.
* c-parse.y (cast_expr): Likewise.
* c-typeck.c (require_complete_type, c_sizeof, c_sizeof_nowarn,
c_size_in_bytes, c_alignof, build_component_ref,
build_indirect_ref, build_array_ref, convert_arguments,
build_binary_op, pointer_diff, build_unary_op, digest_init: Likewise.
* calls.c (initialize_argument_information): Likewise.
* convert.c (convert_to_integer): Likewise.
* dbxout.c (dbxout_typedefs, dbxout_type, dbxout_symbol): Likewise.
* dwarfout.c (location_or_const_value_attribute,
output_enumeration_type_die, output_structure_type_die,
output_union_type_die, output_type): Likewise.
* expr.c (safe_from_p, expand_expr): Likewise.
* function.c (assign_parms): Likewise.
* sdbout.c (sdbout_symbol, sdbout_one_type): Likewise.
* tree.c (build_array_type, build_function_type,
build_method_type, build_offset_type, build_complex_type): Likewise.
* c-parse.c, c-parse.h: Regenerated.
gcc/cp
* typeck.c (require_complete_type, complete_type,
complete_type_or_else, c_sizeof, c_sizeof_nowarn,
build_array_ref, convert_arguments, pointer_diff,
build_x_unary_op, build_unary_op, build_c_cast,
build_modify_expr): Use COMPLETE_TYPE_P etc.
* call.c (is_complete, convert_like_real,
build_new_method_call): Likewise.
* class.c (build_vbase_pointer_fields, check_bases,
build_base_field, finish_struct_1, pushclass): Likewise.
* cvt.c (cp_convert_to_pointer, convert_to_void): Likewise.
* decl.c (maybe_process_template_type_declaration, pushtag,
pushdecl, redeclaration_error_message, start_decl, start_decl_1,
layout_var_decl, check_initializer, cp_finish_decl,
grokdeclarator, require_complete_types_for_parms,
grok_op_properties, xref_tag, xref_basetypes,
check_function_type): Likewise.
* decl2.c (check_classfn, reparse_absdcl_as_casts): Likewise.
* friend.c (do_friend): Likewise.
* init.c (build_offset_ref): Likewise.
* parse.y (structsp): Likewise.
* pt.c (maybe_process_partial_specialization,
tsubst_friend_function, instantiate_class_template, tsubst,
do_type_instantiation, instantiate_pending_templates): Likewise.
* repo.c (repo_get_id): Likewise.
* rtti.c (build_typeid, get_typeid, build_dynamic_cast_1,
synthesize_tinfo_var, emit_support_tinfos): Likewise.
* search.c (lookup_fnfields_1, lookup_conversions): Likewise.
* semantics.c (begin_class_definition): Likewise.
* tree.c (build_cplus_method_type): Likewise.
* typeck2.c (digest_init, build_functional_cast,
add_exception_specifier): Likewise.
* parse.h, parse.c: Regenerated.
From-SVN: r32671
2000-03-21 19:10:48 +01:00
|
|
|
if (!COMPLETE_TYPE_P (t) || TYPE_BEING_DEFINED (t))
|
1998-11-15 20:24:43 +01:00
|
|
|
my_friendly_abort (981113);
|
|
|
|
|
2000-07-04 09:47:11 +02:00
|
|
|
vtable = get_vtbl_decl_for_binfo (TYPE_BINFO (t));
|
|
|
|
|
|
|
|
/* If we don't have a primary vtable, try looking for a secondary
|
|
|
|
vtable. */
|
|
|
|
if (vtable == NULL_TREE && !flag_new_abi
|
|
|
|
&& TYPE_USES_VIRTUAL_BASECLASSES (t))
|
|
|
|
{
|
|
|
|
tree binfos = BINFO_BASETYPES (TYPE_BINFO (t));
|
|
|
|
int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
|
|
|
|
for (i = 0; i < n_baselinks; ++i)
|
|
|
|
{
|
|
|
|
tree base_binfo = TREE_VEC_ELT (binfos, i);
|
|
|
|
if (TREE_VIA_VIRTUAL (base_binfo))
|
|
|
|
{
|
|
|
|
vtable = get_vtbl_decl_for_binfo (base_binfo);
|
|
|
|
if (vtable)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
t = vtable;
|
1995-04-18 21:23:38 +02:00
|
|
|
if (t == NULL_TREE)
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
return DECL_ASSEMBLER_NAME (t);
|
|
|
|
}
|
|
|
|
|
1995-04-03 21:28:01 +02:00
|
|
|
/* Note that a template has been used. If we can see the definition, offer
|
1996-07-11 03:13:25 +02:00
|
|
|
to emit it. */
|
1995-04-03 21:28:01 +02:00
|
|
|
|
|
|
|
void
|
|
|
|
repo_template_used (t)
|
|
|
|
tree t;
|
|
|
|
{
|
|
|
|
tree id;
|
|
|
|
|
|
|
|
if (! flag_use_repository)
|
|
|
|
return;
|
|
|
|
|
1995-04-18 21:23:38 +02:00
|
|
|
id = repo_get_id (t);
|
|
|
|
if (id == NULL_TREE)
|
|
|
|
return;
|
|
|
|
|
builtin.c (get_pointer_alignment): Use DECL_P and TYPE_P macros.
* builtin.c (get_pointer_alignment): Use DECL_P and TYPE_P macros.
* c-common.c (decl_attributes,check_format_info,truthvalue_conversion,
c_get_alias_set): Likewise.
* c-decl.c (duplicate_decls): Likewise.
* c-typeck.c (default_conversion,build_unary_op): Likewise.
* calls.c (initialize_argument_information): Likewise.
* dwarf2out.c (decl_class_context,add_abstract_origin_attribute):
Likewise.
* dwarfout.c (decl_class_context,output_type): Likewise.
* expr.c (get_inner_reference): Likewise.
* fold-const.c (simple_operand_p,fold): Likewise.
* function.c (aggregate_value_p): Likewise.
* stmt.c (expand_asm_operands): Likewise.
* varasm.c (named_section): Likewise.
* call.c (check_dtor_name,build_new_method_call): Likewise.
* decl.c (push_class_binding,poplevel,pushtag,lookup_namespace_name,
make_typename_type,check_initializer,cp_finish_decl,xref_tag): Likewise.
* decl2.c (grokfield,build_expr_from_tree,build_expr_from_tree,
decl_namespace,arg_assoc_template_arg,arg_assoc,
validate_nonmember_using_decl,do_class_using_decl): Likewise.
* error.c (dump_template_argument,dump_expr,cp_file_of,cp_line_of,
args_to_string): Likewise.
* friend.c (is_friend): Likewise.
* lex.c (note_got_semicolon,note_list_got_semicolon,is_global): Likewise.
* method.c (build_overload_nested_name,build_overload_value,
build_qualified_name,build_qualified_name,hack_identifier): Likewise.
* parse.y (typename_sub,typename_sub1): Likewise.
* pt.c (push_inline_template_parms_recursive,check_template_shadow,
process_partial_specialization,convert_template_argument,
template_args_equal,add_pending_template,lookup_template_class,
for_each_template_parm_r,maybe_fold_nontype_arg,
tsubst,instantiate_template,type_unification_real,unify,
instantiate_pending_templates,set_mangled_name_for_template_decl):
Likewise.
* repo.c (repo_get_id,repo_template_used): Likewise.
* search.c (lookup_field_1): Likewise.
* tree.c (walk_tree,get_type_decl,cp_tree_equal,member_p): Likewise.
* xref.c (classname): Likewise.
From-SVN: r32698
2000-03-23 01:41:05 +01:00
|
|
|
if (TYPE_P (t))
|
1995-04-03 21:28:01 +02:00
|
|
|
{
|
|
|
|
if (IDENTIFIER_REPO_CHOSEN (id))
|
|
|
|
mark_class_instantiated (t, 0);
|
|
|
|
}
|
builtin.c (get_pointer_alignment): Use DECL_P and TYPE_P macros.
* builtin.c (get_pointer_alignment): Use DECL_P and TYPE_P macros.
* c-common.c (decl_attributes,check_format_info,truthvalue_conversion,
c_get_alias_set): Likewise.
* c-decl.c (duplicate_decls): Likewise.
* c-typeck.c (default_conversion,build_unary_op): Likewise.
* calls.c (initialize_argument_information): Likewise.
* dwarf2out.c (decl_class_context,add_abstract_origin_attribute):
Likewise.
* dwarfout.c (decl_class_context,output_type): Likewise.
* expr.c (get_inner_reference): Likewise.
* fold-const.c (simple_operand_p,fold): Likewise.
* function.c (aggregate_value_p): Likewise.
* stmt.c (expand_asm_operands): Likewise.
* varasm.c (named_section): Likewise.
* call.c (check_dtor_name,build_new_method_call): Likewise.
* decl.c (push_class_binding,poplevel,pushtag,lookup_namespace_name,
make_typename_type,check_initializer,cp_finish_decl,xref_tag): Likewise.
* decl2.c (grokfield,build_expr_from_tree,build_expr_from_tree,
decl_namespace,arg_assoc_template_arg,arg_assoc,
validate_nonmember_using_decl,do_class_using_decl): Likewise.
* error.c (dump_template_argument,dump_expr,cp_file_of,cp_line_of,
args_to_string): Likewise.
* friend.c (is_friend): Likewise.
* lex.c (note_got_semicolon,note_list_got_semicolon,is_global): Likewise.
* method.c (build_overload_nested_name,build_overload_value,
build_qualified_name,build_qualified_name,hack_identifier): Likewise.
* parse.y (typename_sub,typename_sub1): Likewise.
* pt.c (push_inline_template_parms_recursive,check_template_shadow,
process_partial_specialization,convert_template_argument,
template_args_equal,add_pending_template,lookup_template_class,
for_each_template_parm_r,maybe_fold_nontype_arg,
tsubst,instantiate_template,type_unification_real,unify,
instantiate_pending_templates,set_mangled_name_for_template_decl):
Likewise.
* repo.c (repo_get_id,repo_template_used): Likewise.
* search.c (lookup_field_1): Likewise.
* tree.c (walk_tree,get_type_decl,cp_tree_equal,member_p): Likewise.
* xref.c (classname): Likewise.
From-SVN: r32698
2000-03-23 01:41:05 +01:00
|
|
|
else if (DECL_P (t))
|
1995-04-03 21:28:01 +02:00
|
|
|
{
|
|
|
|
if (IDENTIFIER_REPO_CHOSEN (id))
|
1996-02-28 23:01:56 +01:00
|
|
|
mark_decl_instantiated (t, 0);
|
1995-04-03 21:28:01 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
my_friendly_abort (1);
|
|
|
|
|
|
|
|
if (! IDENTIFIER_REPO_USED (id))
|
|
|
|
{
|
|
|
|
IDENTIFIER_REPO_USED (id) = 1;
|
1999-09-09 08:17:13 +02:00
|
|
|
pending_repo = tree_cons (NULL_TREE, id, pending_repo);
|
1995-04-03 21:28:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1996-02-28 23:01:56 +01:00
|
|
|
#if 0
|
1995-04-03 21:28:01 +02:00
|
|
|
/* Note that the vtable for a class has been used, and offer to emit it. */
|
|
|
|
|
1996-02-28 23:01:56 +01:00
|
|
|
static void
|
1995-04-03 21:28:01 +02:00
|
|
|
repo_vtable_used (t)
|
|
|
|
tree t;
|
|
|
|
{
|
|
|
|
if (! flag_use_repository)
|
|
|
|
return;
|
|
|
|
|
1999-09-09 08:17:13 +02:00
|
|
|
pending_repo = tree_cons (NULL_TREE, t, pending_repo);
|
1995-04-03 21:28:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Note that an inline with external linkage has been used, and offer to
|
|
|
|
emit it. */
|
|
|
|
|
|
|
|
void
|
|
|
|
repo_inline_used (fn)
|
|
|
|
tree fn;
|
|
|
|
{
|
|
|
|
if (! flag_use_repository)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Member functions of polymorphic classes go with their vtables. */
|
1999-12-21 01:19:01 +01:00
|
|
|
if (DECL_FUNCTION_MEMBER_P (fn)
|
Make DECL_CONTEXT mean the class in which a member function was declared, even for a virtual function.
Make DECL_CONTEXT mean the class in which a member function was
declared, even for a virtual function.
* cp-tree.h (DECL_CLASS_CONTEXT): Adjust.
(DECL_FRIEND_CONTEXT): New macro.
(DECL_REAL_CONTEXT): Remove.
(SET_DECL_FRIEND_CONTEXT): Likewise.
(DECL_VIRTUAL_CONTEXT): Adjust.
(DECL_CLASS_SCOPE_P): Use TYPE_P.
(add_friends): Remove.
(hack_decl_function_context): Likewise.
* call.c (build_new_function_call): Replace DECL_REAL_CONTEXT with
CP_DECL_CONTEXT.
(build_over_call): Fix indentation. Use DECL_CONTEXT
instead of DECL_CLASS_CONTEXT.
* class.c (dfs_build_vcall_offset_vtbl_entries): Likewise.
(add_method): Set DECL_VIRTUAL_CONTEXT, not DECL_CLASS_CONTEXT.
(strictly_overrides): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT.
(build_vtbl_or_vbase_field): Don't set DECL_CLASS_CONTEXT.
(build_base_field): Likewise.
(finish_struct_1): Likewise.
(build_self_reference): Likewise.
* decl.c (push_class_binding): Use CP_DECL_CONTEXT, not
DECL_REAL_CONTEXT.
(pushtag): Use decl_function_context, not
hack_decl_function_context.
(decls_match): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT.
(duplicate_decls): Use DECL_VIRTUAL_CONTEXT.
(pushdecl): Remove bogus code.
(start_decl): Use DECL_CONTEXT rather than DECL_CLASS_CONTEXT.
(cp_finish_decl): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT.
(grokfndecl): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT.
Use decl_function_context, nothack_decl_function_context.
(grokvardecl): Don't set DECL_CLASS_CONTEXT.
(grokdeclarator): Likewise. Use decl_function_context, not
hack_decl_function_context.
(copy_args_p): Document. Don't use DECL_CLASS_CONTEXT.
(start_function): Use DECL_FRIEND_CONTEXT, not
DECL_CLASS_CONTEXT. Use decl_function_context, not
hack_decl_function_context.
(finish_function): Use decl_function_context, not
hack_decl_function_context.
(maybe_retrofit_in_chrg): Use DECL_CONTEXT, not
DECL_CLASS_CONTEXT.
(grokclassfn): Set DECL_VIRTUAL_CONTEXT, not DECL_CONTEXT.
(finish_static_data_member_decl): Don't set DECL_CLASS_CONTEXT.
(grokfield): Likewise.
(finish_builtin_type): Likewise.
(finish_vtable_vardec): Use decl_function_context, not
hack_decl_function_context.
(import_export_decl): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT.
(start_static_initialization_or_destruction): Likewise.
(finish_static_initialization_or_destruction): Likewise.
(mark_used): Adjust logic for deciding when to synthesize methods.
* dump.c (dequeue_and_dump): Use CP_DECL_CONTEXT, not
DECL_REAL_CONTEXT.
* error.c (dump_function_decl): Use DECL_CONTEXT, not
DECL_CLASS_CONTEXT.
* friend.c (is_friend): Likewise.
(add_friends): Remove.
(do_friend): Use SET_DECL_FRIEND_CONTEXT.
* lex.c (begin_definition_of_inclass_inline): Use
decl_function_context, not hack_decl_function_context.
(process_next_inline): Likewise.
(do_identifier): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT.
* method.c (set_mangled_name_for_decl): Use DECL_CONTEXT, not
DECL_CLASSS_CONTEXT.
(hack_identifier): Likewise.
(synthesize_method): Use decl_function_context, not
hack_decl_function_context.
* pt.c (template_class_depth_real): Use CP_DECL_CONTEXT, not
DECL_REAL_CONTEXT.
(is_member_template): Use decl_function_context, not
hack_decl_function_context. Use DECL_CONTEXT, not
DECL_CLASS_CONTEXT.
(build_template_decl): Set DECL_VIRTUAL_CONTEXT, not
DECL_CLASS_CONTEXT.
(check_default_tmpl_args): Use CP_DECL_CONTEXT, not
DECL_REAL_CONTEXT.
(push_template_decl_real): Likewise.
(instantiate_class_template): Don't call add_friends.
(tsubst_default_argument): Use DECL_CONTEXT, not
DECL_REAL_CONTEXT.
(tsubst_decl): Set DECL_VIRTUAL_CONTEXT, not DECL_CLASS_CONTEXT.
Use DECL_CONTEXT, not DECL_CLASS_CONTEXT.
(set_meangled_name_for_template_decl): Use DECL_CONTEXT, not
DECL_CLASS_CONTEXT.
* repo.c (repo_inline_used): Likewise.
* search.c (current_scope): Adjust for new _CONTEXT macros.
(context_for_name_lookup): Use CP_DECL_CONTEXT, not
DECL_REAL_CONTEXT.
(friend_accessible_p): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT.
(lookup_fnfields_here):Likewise.
(check_final_overrider): Likewise.
(init_vbase_pointers): Likewise.
(virtual_context): Likewise.
* semantics.c (finish_member_declaration): Just set DECL_CONTEXT.
(expand_body): Use decl_function_context, not
hack_decl_function_context.
* tree.c (hack_decl_function_context): Remove.
* typeck.c (build_x_function_call): Use DECL_CONTEXT, not
DECL_CLASS_CONTEXT.
* typeck2.c (error_not_base_type): Likewise.
From-SVN: r32018
2000-02-17 00:54:23 +01:00
|
|
|
&& TYPE_POLYMORPHIC_P (DECL_CONTEXT (fn)))
|
1995-04-03 21:28:01 +02:00
|
|
|
{
|
Make DECL_CONTEXT mean the class in which a member function was declared, even for a virtual function.
Make DECL_CONTEXT mean the class in which a member function was
declared, even for a virtual function.
* cp-tree.h (DECL_CLASS_CONTEXT): Adjust.
(DECL_FRIEND_CONTEXT): New macro.
(DECL_REAL_CONTEXT): Remove.
(SET_DECL_FRIEND_CONTEXT): Likewise.
(DECL_VIRTUAL_CONTEXT): Adjust.
(DECL_CLASS_SCOPE_P): Use TYPE_P.
(add_friends): Remove.
(hack_decl_function_context): Likewise.
* call.c (build_new_function_call): Replace DECL_REAL_CONTEXT with
CP_DECL_CONTEXT.
(build_over_call): Fix indentation. Use DECL_CONTEXT
instead of DECL_CLASS_CONTEXT.
* class.c (dfs_build_vcall_offset_vtbl_entries): Likewise.
(add_method): Set DECL_VIRTUAL_CONTEXT, not DECL_CLASS_CONTEXT.
(strictly_overrides): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT.
(build_vtbl_or_vbase_field): Don't set DECL_CLASS_CONTEXT.
(build_base_field): Likewise.
(finish_struct_1): Likewise.
(build_self_reference): Likewise.
* decl.c (push_class_binding): Use CP_DECL_CONTEXT, not
DECL_REAL_CONTEXT.
(pushtag): Use decl_function_context, not
hack_decl_function_context.
(decls_match): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT.
(duplicate_decls): Use DECL_VIRTUAL_CONTEXT.
(pushdecl): Remove bogus code.
(start_decl): Use DECL_CONTEXT rather than DECL_CLASS_CONTEXT.
(cp_finish_decl): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT.
(grokfndecl): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT.
Use decl_function_context, nothack_decl_function_context.
(grokvardecl): Don't set DECL_CLASS_CONTEXT.
(grokdeclarator): Likewise. Use decl_function_context, not
hack_decl_function_context.
(copy_args_p): Document. Don't use DECL_CLASS_CONTEXT.
(start_function): Use DECL_FRIEND_CONTEXT, not
DECL_CLASS_CONTEXT. Use decl_function_context, not
hack_decl_function_context.
(finish_function): Use decl_function_context, not
hack_decl_function_context.
(maybe_retrofit_in_chrg): Use DECL_CONTEXT, not
DECL_CLASS_CONTEXT.
(grokclassfn): Set DECL_VIRTUAL_CONTEXT, not DECL_CONTEXT.
(finish_static_data_member_decl): Don't set DECL_CLASS_CONTEXT.
(grokfield): Likewise.
(finish_builtin_type): Likewise.
(finish_vtable_vardec): Use decl_function_context, not
hack_decl_function_context.
(import_export_decl): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT.
(start_static_initialization_or_destruction): Likewise.
(finish_static_initialization_or_destruction): Likewise.
(mark_used): Adjust logic for deciding when to synthesize methods.
* dump.c (dequeue_and_dump): Use CP_DECL_CONTEXT, not
DECL_REAL_CONTEXT.
* error.c (dump_function_decl): Use DECL_CONTEXT, not
DECL_CLASS_CONTEXT.
* friend.c (is_friend): Likewise.
(add_friends): Remove.
(do_friend): Use SET_DECL_FRIEND_CONTEXT.
* lex.c (begin_definition_of_inclass_inline): Use
decl_function_context, not hack_decl_function_context.
(process_next_inline): Likewise.
(do_identifier): Use CP_DECL_CONTEXT, not DECL_REAL_CONTEXT.
* method.c (set_mangled_name_for_decl): Use DECL_CONTEXT, not
DECL_CLASSS_CONTEXT.
(hack_identifier): Likewise.
(synthesize_method): Use decl_function_context, not
hack_decl_function_context.
* pt.c (template_class_depth_real): Use CP_DECL_CONTEXT, not
DECL_REAL_CONTEXT.
(is_member_template): Use decl_function_context, not
hack_decl_function_context. Use DECL_CONTEXT, not
DECL_CLASS_CONTEXT.
(build_template_decl): Set DECL_VIRTUAL_CONTEXT, not
DECL_CLASS_CONTEXT.
(check_default_tmpl_args): Use CP_DECL_CONTEXT, not
DECL_REAL_CONTEXT.
(push_template_decl_real): Likewise.
(instantiate_class_template): Don't call add_friends.
(tsubst_default_argument): Use DECL_CONTEXT, not
DECL_REAL_CONTEXT.
(tsubst_decl): Set DECL_VIRTUAL_CONTEXT, not DECL_CLASS_CONTEXT.
Use DECL_CONTEXT, not DECL_CLASS_CONTEXT.
(set_meangled_name_for_template_decl): Use DECL_CONTEXT, not
DECL_CLASS_CONTEXT.
* repo.c (repo_inline_used): Likewise.
* search.c (current_scope): Adjust for new _CONTEXT macros.
(context_for_name_lookup): Use CP_DECL_CONTEXT, not
DECL_REAL_CONTEXT.
(friend_accessible_p): Use DECL_CONTEXT, not DECL_CLASS_CONTEXT.
(lookup_fnfields_here):Likewise.
(check_final_overrider): Likewise.
(init_vbase_pointers): Likewise.
(virtual_context): Likewise.
* semantics.c (finish_member_declaration): Just set DECL_CONTEXT.
(expand_body): Use decl_function_context, not
hack_decl_function_context.
* tree.c (hack_decl_function_context): Remove.
* typeck.c (build_x_function_call): Use DECL_CONTEXT, not
DECL_CLASS_CONTEXT.
* typeck2.c (error_not_base_type): Likewise.
From-SVN: r32018
2000-02-17 00:54:23 +01:00
|
|
|
repo_vtable_used (DECL_CONTEXT (fn));
|
1995-04-03 21:28:01 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-09-09 08:17:13 +02:00
|
|
|
pending_repo = tree_cons (NULL_TREE, fn, pending_repo);
|
1995-04-03 21:28:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Note that a particular typeinfo node has been used, and offer to
|
|
|
|
emit it. */
|
|
|
|
|
|
|
|
void
|
|
|
|
repo_tinfo_used (ti)
|
|
|
|
tree ti;
|
|
|
|
{
|
|
|
|
}
|
1996-02-28 23:01:56 +01:00
|
|
|
#endif
|
1995-04-03 21:28:01 +02:00
|
|
|
|
1995-04-18 21:23:38 +02:00
|
|
|
void
|
|
|
|
repo_template_instantiated (t, extern_p)
|
|
|
|
tree t;
|
|
|
|
int extern_p;
|
|
|
|
{
|
|
|
|
if (! extern_p)
|
|
|
|
{
|
|
|
|
tree id = repo_get_id (t);
|
|
|
|
if (id)
|
|
|
|
IDENTIFIER_REPO_CHOSEN (id) = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-06-18 04:25:37 +02:00
|
|
|
/* Parse a reasonable subset of shell quoting syntax. */
|
|
|
|
|
|
|
|
static char *
|
|
|
|
extract_string (pp)
|
|
|
|
char **pp;
|
|
|
|
{
|
|
|
|
char *p = *pp;
|
|
|
|
int backquote = 0;
|
|
|
|
int inside = 0;
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
char c = *p;
|
|
|
|
if (c == '\0')
|
|
|
|
break;
|
|
|
|
++p;
|
|
|
|
if (backquote)
|
|
|
|
obstack_1grow (&temporary_obstack, c);
|
|
|
|
else if (! inside && c == ' ')
|
|
|
|
break;
|
|
|
|
else if (! inside && c == '\\')
|
|
|
|
backquote = 1;
|
|
|
|
else if (c == '\'')
|
|
|
|
inside = !inside;
|
|
|
|
else
|
|
|
|
obstack_1grow (&temporary_obstack, c);
|
|
|
|
}
|
|
|
|
|
|
|
|
obstack_1grow (&temporary_obstack, '\0');
|
|
|
|
*pp = p;
|
|
|
|
return obstack_finish (&temporary_obstack);
|
|
|
|
}
|
|
|
|
|
1995-04-04 19:51:34 +02:00
|
|
|
static char *
|
|
|
|
get_base_filename (filename)
|
Warning fixes:
* call.c (op_error): Const-ify a char*.
(add_candidate, source_type, add_warning): Add static prototype.
(print_z_candidates): Const-ify a char*.
* class.c (resolve_address_of_overloaded_function,
fixed_type_or_null, build_vtable_entry_ref): Add static prototype.
(get_vtable_name, finish_struct_1): Const-ify a char*.
* cvt.c (convert_to_reference): Likewise.
* decl.c (redeclaration_error_message, record_builtin_type,
record_unknown_type, member_function_or_else, bad_specifiers):
Likewise.
(find_binding, select_decl, unqualified_namespace_lookup,
lookup_flags, qualify_lookup, record_builtin_java_type, tag_name):
Add static prototype.
(warn_extern_redeclared_static, duplicate_decls, pushdecl,
implicitly_declare, record_builtin_java_type, define_function,
grok_op_properties, tag_name): Const-ify a char*.
* cp-tree.h (FORMAT_VBASE_NAME): Allow parameter `BUF' to be const.
(define_function, finish_builtin_type): Const-ify a char*.
(cp_error, cp_error_at, cp_warning, cp_warning_at, cp_pedwarn,
cp_pedwarn_at, cp_compiler_error, cp_sprintf): Add prototype args.
(file_name_nondirectory): Const-ify a char*.
(init_filename_times): Don't prototype.
(compiler_error): Prototype.
(yyerror, init_repo): Const-ify a char*.
(build_srcloc): Don't prototype.
(build_x_indirect_ref, build_indirect_ref, build_component_addr):
Const-ify a char*.
(warn_for_assignment): Don't prototype.
(convert_for_initialization, readonly_error, check_for_new_type,
GNU_xref_begin, GNU_xref_file, GNU_xref_ref, GNU_xref_call):
Const-ify a char*.
* decl2.c (acceptable_java_type, output_vtable_inherit,
setup_initp, start_objects, finish_objects, do_dtors, do_ctors,
merge_functions, decl_namespace, validate_nonmember_using_decl,
do_nonmember_using_decl): Add static prototype.
(lang_f_options): Const-ify a char*.
(finish_builtin_type): Likewise.
(add_function, arg_assoc_namespace, arg_assoc_class): Add static
prototype.
* errfn.c: Include cp-tree.h.
(cp_thing): Add static prototype.
(compiler_error): Don't protoptype.
(cp_compiler_error): Cast `compiler_error' to `errorfn' before
passing it to `cp_thing'.
* error.c (interesting_scope_p): Add static prototype.
* except.c (build_eh_type_type, build_eh_type_type_ref): Const-ify
a char*.
* init.c (compiler_error): Don't prototype.
(member_init_ok_or_else): Const-ify a char*.
(build_java_class_ref): Add static prototype.
* lex.c (compiler_error): Don't prototype.
(get_time_identifier, interface_strcmp, extend_token_buffer,
handle_cp_pragma): Const-ify a char*.
(is_global, init_filename_times): Add static prototype.
(file_name_nondirectory, cplus_tree_code_name): Const-ify a char*.
(compiler_error): Change from fixed args to variable args.
(yyerror): Const-ify a char*.
* parse.y (cond_stmt_keyword): Const-ify a char*.
(parse_decl): Add static prototype.
* pt.c (template_args_equal, print_template_context): Likewise.
(print_candidates, check_default_tmpl_args): Const-ify a char*.
(instantiate_class_template): Likewise.
* repo.c (get_base_filename, open_repo_file, init_repo): Likewise.
* rtti.c (call_void_fn, expand_generic_desc, expand_si_desc,
expand_class_desc, expand_ptr_desc, expand_attr_desc): Likewise.
* search.c (lookup_field_info, lookup_member): Likewise.
(lookup_member): Cast the first argument of `bzero' to a PTR.
* sig.c (compiler_error): Don't prototype.
(build_signature_pointer_or_reference_nam): Const-ify a char*.
(get_sigtable_name, build_member_function_pointer): Likewise.
* tree.c (compiler_error): Don't prototype.
(no_linkage_helper, build_srcloc): Add static prototype.
(build_vbase_pointer_fields): Const-ify a char*.
(__eprintf): Don't unnecessarily handle `const' when !__STDC__.
* typeck.c (compiler_error): Don't prototype.
(convert_for_assignment): Const-ify a char*.
(comp_cv_target_types): Add static prototype.
(build_x_indirect_ref, build_indirect_ref, convert_arguments,
build_component_addr, build_unary_op, convert_for_initialization):
Const-ify a char*.
* typeck2.c (ack): Add static prototype and change from fixed args
to variable args.
(readonly_error, check_for_new_type): Const-ify a char*.
* xref.c (_XREF_FILE, find_file, filename, fctname, declname,
fixname, open_xref_file, classname, GNU_xref_begin): Likewise.
(GNU_xref_file): Likewise. Also use `xmalloc' instead of `malloc'.
(GNU_xref_end_scope, GNU_xref_ref, GNU_xref_decl, GNU_xref_call,
gen_assign, GNU_xref_member): Const-ify a char*.
From-SVN: r25994
1999-03-26 08:45:00 +01:00
|
|
|
const char *filename;
|
1995-04-04 19:51:34 +02:00
|
|
|
{
|
|
|
|
char *p = getenv ("COLLECT_GCC_OPTIONS");
|
1997-06-18 04:25:37 +02:00
|
|
|
char *output = NULL;
|
1995-04-04 19:51:34 +02:00
|
|
|
int compiling = 0;
|
|
|
|
|
1997-06-18 04:25:37 +02:00
|
|
|
while (p && *p)
|
|
|
|
{
|
|
|
|
char *q = extract_string (&p);
|
1995-04-04 19:51:34 +02:00
|
|
|
|
1997-06-18 04:25:37 +02:00
|
|
|
if (strcmp (q, "-o") == 0)
|
|
|
|
output = extract_string (&p);
|
|
|
|
else if (strcmp (q, "-c") == 0)
|
|
|
|
compiling = 1;
|
1995-04-04 19:51:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (compiling && output)
|
|
|
|
return output;
|
|
|
|
|
1995-04-09 13:41:24 +02:00
|
|
|
if (p && ! compiling)
|
|
|
|
{
|
1998-09-07 16:25:35 +02:00
|
|
|
warning ("-frepo must be used with -c");
|
1995-04-09 13:41:24 +02:00
|
|
|
flag_use_repository = 0;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1998-07-12 03:53:48 +02:00
|
|
|
return file_name_nondirectory (filename);
|
1995-04-04 19:51:34 +02:00
|
|
|
}
|
|
|
|
|
1995-04-03 21:28:01 +02:00
|
|
|
static void
|
|
|
|
open_repo_file (filename)
|
Warning fixes:
* call.c (op_error): Const-ify a char*.
(add_candidate, source_type, add_warning): Add static prototype.
(print_z_candidates): Const-ify a char*.
* class.c (resolve_address_of_overloaded_function,
fixed_type_or_null, build_vtable_entry_ref): Add static prototype.
(get_vtable_name, finish_struct_1): Const-ify a char*.
* cvt.c (convert_to_reference): Likewise.
* decl.c (redeclaration_error_message, record_builtin_type,
record_unknown_type, member_function_or_else, bad_specifiers):
Likewise.
(find_binding, select_decl, unqualified_namespace_lookup,
lookup_flags, qualify_lookup, record_builtin_java_type, tag_name):
Add static prototype.
(warn_extern_redeclared_static, duplicate_decls, pushdecl,
implicitly_declare, record_builtin_java_type, define_function,
grok_op_properties, tag_name): Const-ify a char*.
* cp-tree.h (FORMAT_VBASE_NAME): Allow parameter `BUF' to be const.
(define_function, finish_builtin_type): Const-ify a char*.
(cp_error, cp_error_at, cp_warning, cp_warning_at, cp_pedwarn,
cp_pedwarn_at, cp_compiler_error, cp_sprintf): Add prototype args.
(file_name_nondirectory): Const-ify a char*.
(init_filename_times): Don't prototype.
(compiler_error): Prototype.
(yyerror, init_repo): Const-ify a char*.
(build_srcloc): Don't prototype.
(build_x_indirect_ref, build_indirect_ref, build_component_addr):
Const-ify a char*.
(warn_for_assignment): Don't prototype.
(convert_for_initialization, readonly_error, check_for_new_type,
GNU_xref_begin, GNU_xref_file, GNU_xref_ref, GNU_xref_call):
Const-ify a char*.
* decl2.c (acceptable_java_type, output_vtable_inherit,
setup_initp, start_objects, finish_objects, do_dtors, do_ctors,
merge_functions, decl_namespace, validate_nonmember_using_decl,
do_nonmember_using_decl): Add static prototype.
(lang_f_options): Const-ify a char*.
(finish_builtin_type): Likewise.
(add_function, arg_assoc_namespace, arg_assoc_class): Add static
prototype.
* errfn.c: Include cp-tree.h.
(cp_thing): Add static prototype.
(compiler_error): Don't protoptype.
(cp_compiler_error): Cast `compiler_error' to `errorfn' before
passing it to `cp_thing'.
* error.c (interesting_scope_p): Add static prototype.
* except.c (build_eh_type_type, build_eh_type_type_ref): Const-ify
a char*.
* init.c (compiler_error): Don't prototype.
(member_init_ok_or_else): Const-ify a char*.
(build_java_class_ref): Add static prototype.
* lex.c (compiler_error): Don't prototype.
(get_time_identifier, interface_strcmp, extend_token_buffer,
handle_cp_pragma): Const-ify a char*.
(is_global, init_filename_times): Add static prototype.
(file_name_nondirectory, cplus_tree_code_name): Const-ify a char*.
(compiler_error): Change from fixed args to variable args.
(yyerror): Const-ify a char*.
* parse.y (cond_stmt_keyword): Const-ify a char*.
(parse_decl): Add static prototype.
* pt.c (template_args_equal, print_template_context): Likewise.
(print_candidates, check_default_tmpl_args): Const-ify a char*.
(instantiate_class_template): Likewise.
* repo.c (get_base_filename, open_repo_file, init_repo): Likewise.
* rtti.c (call_void_fn, expand_generic_desc, expand_si_desc,
expand_class_desc, expand_ptr_desc, expand_attr_desc): Likewise.
* search.c (lookup_field_info, lookup_member): Likewise.
(lookup_member): Cast the first argument of `bzero' to a PTR.
* sig.c (compiler_error): Don't prototype.
(build_signature_pointer_or_reference_nam): Const-ify a char*.
(get_sigtable_name, build_member_function_pointer): Likewise.
* tree.c (compiler_error): Don't prototype.
(no_linkage_helper, build_srcloc): Add static prototype.
(build_vbase_pointer_fields): Const-ify a char*.
(__eprintf): Don't unnecessarily handle `const' when !__STDC__.
* typeck.c (compiler_error): Don't prototype.
(convert_for_assignment): Const-ify a char*.
(comp_cv_target_types): Add static prototype.
(build_x_indirect_ref, build_indirect_ref, convert_arguments,
build_component_addr, build_unary_op, convert_for_initialization):
Const-ify a char*.
* typeck2.c (ack): Add static prototype and change from fixed args
to variable args.
(readonly_error, check_for_new_type): Const-ify a char*.
* xref.c (_XREF_FILE, find_file, filename, fctname, declname,
fixname, open_xref_file, classname, GNU_xref_begin): Likewise.
(GNU_xref_file): Likewise. Also use `xmalloc' instead of `malloc'.
(GNU_xref_end_scope, GNU_xref_ref, GNU_xref_decl, GNU_xref_call,
gen_assign, GNU_xref_member): Const-ify a char*.
From-SVN: r25994
1999-03-26 08:45:00 +01:00
|
|
|
const char *filename;
|
1995-04-03 21:28:01 +02:00
|
|
|
{
|
Warning fixes:
* call.c (op_error): Const-ify a char*.
(add_candidate, source_type, add_warning): Add static prototype.
(print_z_candidates): Const-ify a char*.
* class.c (resolve_address_of_overloaded_function,
fixed_type_or_null, build_vtable_entry_ref): Add static prototype.
(get_vtable_name, finish_struct_1): Const-ify a char*.
* cvt.c (convert_to_reference): Likewise.
* decl.c (redeclaration_error_message, record_builtin_type,
record_unknown_type, member_function_or_else, bad_specifiers):
Likewise.
(find_binding, select_decl, unqualified_namespace_lookup,
lookup_flags, qualify_lookup, record_builtin_java_type, tag_name):
Add static prototype.
(warn_extern_redeclared_static, duplicate_decls, pushdecl,
implicitly_declare, record_builtin_java_type, define_function,
grok_op_properties, tag_name): Const-ify a char*.
* cp-tree.h (FORMAT_VBASE_NAME): Allow parameter `BUF' to be const.
(define_function, finish_builtin_type): Const-ify a char*.
(cp_error, cp_error_at, cp_warning, cp_warning_at, cp_pedwarn,
cp_pedwarn_at, cp_compiler_error, cp_sprintf): Add prototype args.
(file_name_nondirectory): Const-ify a char*.
(init_filename_times): Don't prototype.
(compiler_error): Prototype.
(yyerror, init_repo): Const-ify a char*.
(build_srcloc): Don't prototype.
(build_x_indirect_ref, build_indirect_ref, build_component_addr):
Const-ify a char*.
(warn_for_assignment): Don't prototype.
(convert_for_initialization, readonly_error, check_for_new_type,
GNU_xref_begin, GNU_xref_file, GNU_xref_ref, GNU_xref_call):
Const-ify a char*.
* decl2.c (acceptable_java_type, output_vtable_inherit,
setup_initp, start_objects, finish_objects, do_dtors, do_ctors,
merge_functions, decl_namespace, validate_nonmember_using_decl,
do_nonmember_using_decl): Add static prototype.
(lang_f_options): Const-ify a char*.
(finish_builtin_type): Likewise.
(add_function, arg_assoc_namespace, arg_assoc_class): Add static
prototype.
* errfn.c: Include cp-tree.h.
(cp_thing): Add static prototype.
(compiler_error): Don't protoptype.
(cp_compiler_error): Cast `compiler_error' to `errorfn' before
passing it to `cp_thing'.
* error.c (interesting_scope_p): Add static prototype.
* except.c (build_eh_type_type, build_eh_type_type_ref): Const-ify
a char*.
* init.c (compiler_error): Don't prototype.
(member_init_ok_or_else): Const-ify a char*.
(build_java_class_ref): Add static prototype.
* lex.c (compiler_error): Don't prototype.
(get_time_identifier, interface_strcmp, extend_token_buffer,
handle_cp_pragma): Const-ify a char*.
(is_global, init_filename_times): Add static prototype.
(file_name_nondirectory, cplus_tree_code_name): Const-ify a char*.
(compiler_error): Change from fixed args to variable args.
(yyerror): Const-ify a char*.
* parse.y (cond_stmt_keyword): Const-ify a char*.
(parse_decl): Add static prototype.
* pt.c (template_args_equal, print_template_context): Likewise.
(print_candidates, check_default_tmpl_args): Const-ify a char*.
(instantiate_class_template): Likewise.
* repo.c (get_base_filename, open_repo_file, init_repo): Likewise.
* rtti.c (call_void_fn, expand_generic_desc, expand_si_desc,
expand_class_desc, expand_ptr_desc, expand_attr_desc): Likewise.
* search.c (lookup_field_info, lookup_member): Likewise.
(lookup_member): Cast the first argument of `bzero' to a PTR.
* sig.c (compiler_error): Don't prototype.
(build_signature_pointer_or_reference_nam): Const-ify a char*.
(get_sigtable_name, build_member_function_pointer): Likewise.
* tree.c (compiler_error): Don't prototype.
(no_linkage_helper, build_srcloc): Add static prototype.
(build_vbase_pointer_fields): Const-ify a char*.
(__eprintf): Don't unnecessarily handle `const' when !__STDC__.
* typeck.c (compiler_error): Don't prototype.
(convert_for_assignment): Const-ify a char*.
(comp_cv_target_types): Add static prototype.
(build_x_indirect_ref, build_indirect_ref, convert_arguments,
build_component_addr, build_unary_op, convert_for_initialization):
Const-ify a char*.
* typeck2.c (ack): Add static prototype and change from fixed args
to variable args.
(readonly_error, check_for_new_type): Const-ify a char*.
* xref.c (_XREF_FILE, find_file, filename, fctname, declname,
fixname, open_xref_file, classname, GNU_xref_begin): Likewise.
(GNU_xref_file): Likewise. Also use `xmalloc' instead of `malloc'.
(GNU_xref_end_scope, GNU_xref_ref, GNU_xref_decl, GNU_xref_call,
gen_assign, GNU_xref_member): Const-ify a char*.
From-SVN: r25994
1999-03-26 08:45:00 +01:00
|
|
|
register const char *p;
|
|
|
|
const char *s = get_base_filename (filename);
|
1995-04-09 13:41:24 +02:00
|
|
|
|
1995-04-24 19:27:46 +02:00
|
|
|
if (s == NULL)
|
1995-04-09 13:41:24 +02:00
|
|
|
return;
|
|
|
|
|
1998-07-12 03:53:48 +02:00
|
|
|
p = file_name_nondirectory (s);
|
1997-11-04 00:20:24 +01:00
|
|
|
p = rindex (p, '.');
|
1995-04-24 19:27:46 +02:00
|
|
|
if (! p)
|
|
|
|
p = s + strlen (s);
|
1995-04-03 21:28:01 +02:00
|
|
|
|
1995-04-24 19:27:46 +02:00
|
|
|
obstack_grow (&permanent_obstack, s, p - s);
|
|
|
|
repo_name = obstack_copy0 (&permanent_obstack, ".rpo", 4);
|
1995-04-03 21:28:01 +02:00
|
|
|
|
|
|
|
repo_file = fopen (repo_name, "r");
|
|
|
|
}
|
|
|
|
|
1995-04-24 19:27:46 +02:00
|
|
|
static char *
|
|
|
|
afgets (stream)
|
|
|
|
FILE *stream;
|
|
|
|
{
|
|
|
|
int c;
|
|
|
|
while ((c = getc (stream)) != EOF && c != '\n')
|
|
|
|
obstack_1grow (&temporary_obstack, c);
|
|
|
|
if (obstack_object_size (&temporary_obstack) == 0)
|
|
|
|
return NULL;
|
|
|
|
obstack_1grow (&temporary_obstack, '\0');
|
|
|
|
return obstack_finish (&temporary_obstack);
|
|
|
|
}
|
|
|
|
|
1995-04-03 21:28:01 +02:00
|
|
|
void
|
|
|
|
init_repo (filename)
|
Warning fixes:
* call.c (op_error): Const-ify a char*.
(add_candidate, source_type, add_warning): Add static prototype.
(print_z_candidates): Const-ify a char*.
* class.c (resolve_address_of_overloaded_function,
fixed_type_or_null, build_vtable_entry_ref): Add static prototype.
(get_vtable_name, finish_struct_1): Const-ify a char*.
* cvt.c (convert_to_reference): Likewise.
* decl.c (redeclaration_error_message, record_builtin_type,
record_unknown_type, member_function_or_else, bad_specifiers):
Likewise.
(find_binding, select_decl, unqualified_namespace_lookup,
lookup_flags, qualify_lookup, record_builtin_java_type, tag_name):
Add static prototype.
(warn_extern_redeclared_static, duplicate_decls, pushdecl,
implicitly_declare, record_builtin_java_type, define_function,
grok_op_properties, tag_name): Const-ify a char*.
* cp-tree.h (FORMAT_VBASE_NAME): Allow parameter `BUF' to be const.
(define_function, finish_builtin_type): Const-ify a char*.
(cp_error, cp_error_at, cp_warning, cp_warning_at, cp_pedwarn,
cp_pedwarn_at, cp_compiler_error, cp_sprintf): Add prototype args.
(file_name_nondirectory): Const-ify a char*.
(init_filename_times): Don't prototype.
(compiler_error): Prototype.
(yyerror, init_repo): Const-ify a char*.
(build_srcloc): Don't prototype.
(build_x_indirect_ref, build_indirect_ref, build_component_addr):
Const-ify a char*.
(warn_for_assignment): Don't prototype.
(convert_for_initialization, readonly_error, check_for_new_type,
GNU_xref_begin, GNU_xref_file, GNU_xref_ref, GNU_xref_call):
Const-ify a char*.
* decl2.c (acceptable_java_type, output_vtable_inherit,
setup_initp, start_objects, finish_objects, do_dtors, do_ctors,
merge_functions, decl_namespace, validate_nonmember_using_decl,
do_nonmember_using_decl): Add static prototype.
(lang_f_options): Const-ify a char*.
(finish_builtin_type): Likewise.
(add_function, arg_assoc_namespace, arg_assoc_class): Add static
prototype.
* errfn.c: Include cp-tree.h.
(cp_thing): Add static prototype.
(compiler_error): Don't protoptype.
(cp_compiler_error): Cast `compiler_error' to `errorfn' before
passing it to `cp_thing'.
* error.c (interesting_scope_p): Add static prototype.
* except.c (build_eh_type_type, build_eh_type_type_ref): Const-ify
a char*.
* init.c (compiler_error): Don't prototype.
(member_init_ok_or_else): Const-ify a char*.
(build_java_class_ref): Add static prototype.
* lex.c (compiler_error): Don't prototype.
(get_time_identifier, interface_strcmp, extend_token_buffer,
handle_cp_pragma): Const-ify a char*.
(is_global, init_filename_times): Add static prototype.
(file_name_nondirectory, cplus_tree_code_name): Const-ify a char*.
(compiler_error): Change from fixed args to variable args.
(yyerror): Const-ify a char*.
* parse.y (cond_stmt_keyword): Const-ify a char*.
(parse_decl): Add static prototype.
* pt.c (template_args_equal, print_template_context): Likewise.
(print_candidates, check_default_tmpl_args): Const-ify a char*.
(instantiate_class_template): Likewise.
* repo.c (get_base_filename, open_repo_file, init_repo): Likewise.
* rtti.c (call_void_fn, expand_generic_desc, expand_si_desc,
expand_class_desc, expand_ptr_desc, expand_attr_desc): Likewise.
* search.c (lookup_field_info, lookup_member): Likewise.
(lookup_member): Cast the first argument of `bzero' to a PTR.
* sig.c (compiler_error): Don't prototype.
(build_signature_pointer_or_reference_nam): Const-ify a char*.
(get_sigtable_name, build_member_function_pointer): Likewise.
* tree.c (compiler_error): Don't prototype.
(no_linkage_helper, build_srcloc): Add static prototype.
(build_vbase_pointer_fields): Const-ify a char*.
(__eprintf): Don't unnecessarily handle `const' when !__STDC__.
* typeck.c (compiler_error): Don't prototype.
(convert_for_assignment): Const-ify a char*.
(comp_cv_target_types): Add static prototype.
(build_x_indirect_ref, build_indirect_ref, convert_arguments,
build_component_addr, build_unary_op, convert_for_initialization):
Const-ify a char*.
* typeck2.c (ack): Add static prototype and change from fixed args
to variable args.
(readonly_error, check_for_new_type): Const-ify a char*.
* xref.c (_XREF_FILE, find_file, filename, fctname, declname,
fixname, open_xref_file, classname, GNU_xref_begin): Likewise.
(GNU_xref_file): Likewise. Also use `xmalloc' instead of `malloc'.
(GNU_xref_end_scope, GNU_xref_ref, GNU_xref_decl, GNU_xref_call,
gen_assign, GNU_xref_member): Const-ify a char*.
From-SVN: r25994
1999-03-26 08:45:00 +01:00
|
|
|
const char *filename;
|
1995-04-03 21:28:01 +02:00
|
|
|
{
|
1995-04-24 19:27:46 +02:00
|
|
|
char *buf;
|
1995-04-03 21:28:01 +02:00
|
|
|
|
|
|
|
if (! flag_use_repository)
|
|
|
|
return;
|
|
|
|
|
Get ready for garbage collection.
* Makefile.in (CXX_TREE_H): Add varray.h
(lex.o): Depend on ggc.h.
(decl.o): Likewise.
(decl2.o): Likewise.
(method.o): Likewise.
(search.o): Likewise.
(pt.o): Likewise.
(repo.o): Likewise.
* class.c: Include ggc.h.
(current_class_name): Remove.
(current_class_type): Likewise.
(current_access_specifier): Likewise.
(previous_class_type): Likewise.
(previous_class_values): Likewise.
(class_cache_firstobj): Likewise.
(current_lang_base): Likewise.
(current_lang_stack): Likewise.
(current_lang_stacksize): Likewise.
(lang_name_c): Likewise.
(lang_name_cplusplus): Likewise.
(lang_name_java): Likewise.
(current_lang_name): Likewise.
(base_layout_decl): Likewise.
(access_default_node): Likewise.
(access_public_node): Likewise.
(access_protected_node): Likewise.
(access_private_node): Likewise.
(access_default_virtual_node): Likewise.
(access_public_virtual_node): Likewise.
(access_protected_virtual_node): Likewise.
(access_private_virtual_node): Likewise.
(signed_zero_node): Likewise.
(init_class_processing): Don't build base_layout_decl.
(push_lang_context): Adjust now that current_lang_base is a varray.
(pop_lang_context): Likewise.
* cp-tree.h: Include varray.h.
(cp_global_trees): Add access_default, access_public,
access_protected, access_private, access_default_virtual,
access_public_virtual, access_protected_virtual,
access_private_virtual, ctor_identifier, delta2_identifier,
delta_identifier, dtor_identifier, in_charge_identifier,
index_identifier, nelts_identifier, this_identifier,
pfn_identifier, pfn_or_delta2_identifier, vptr_identifier,
lang_name_c, lang_name_cplusplus, lang_name_java,
empty_except_spec, null, jclass, minus_one, terminate.
(saved_scope): Move here from decl.c. Define globals in terms of
saved_scope: current_namespace, current_class_name,
current_class_type, current_access_specifier, current_lang_stack,
current_lang_base, current_lang_name, current_function_parms,
current_template_parms, processing_template_decl,
processing_specialization, processing_explicit_instantiation,
previous_class_type, previous_class_values, class_cache_firstobj.
(scope_chain): New variable.
(init_pt): New function.
* decl.c (current_namespace): Remove.
(this_identifier, in_charge_identifier, ctor_identifier): Likewise.
(dtor_identifier, pfn_identifier, index_identifier): Likewise.
(delta_identifier, delta2_identifier): Likewise.
(pfn_or_delta2_identifier, tag_identifier): Likewise
(vt_off_identifier, empty_except_spec, null_node): Likewise.
(current_function_parms, current_lang_base): Remove.
(current_lang_stack, previous_class_values): Remove.
(class_binding_level): Macroize.
(saved_scope): Remove.
(current_saved_scope): Rename to scope_chain.
(mark_saved_scope): Adjust for new scope structure.
(maybe_push_to_top_level): Likewise.
(pop_from_top_level): Likewise.
(duplicate_decls): Adjust now that current_lang_base is a varray.
(build_typename_type): Call ggc_add_tree_hash_table_root.
(init_decl_processing): Call init_pt. Call push_to_top_level to
set up globals. Add GC roots.
(xref_basetypes): Adjust now that current_lang_base is a varray.
* decl.h (this_identifier): Remove.
(in_charge_identifier): Likewise.
* decl2.c: Don't include varray.h.
(current_namespace): Remove.
(init_decl2): Add GC roots.
* except.c (Terminate): Remove.
(init_exception_processing): Use terminate_node instead.
(build_terminate_handler): Likewise.
* init.c (nc_nelts_field_id): Remove.
(minus_one): Likewise.
(init_init_processing): Use minus_one_node and nelts_identifier
instead. Add GC roots.
(jclass_node): Remove.
(build_new_1): Use nelts_identifier.
(build_vec_init): Likewise.
(build_vec_delete): Likewise.
* lex.c: Include ggc.h.
(defarg_fn): Move declaration early.
(defarg_parms): Likewise.
(init_parse): Add GC roots.
(handle_cp_pragma): Remove redundant declaration of
pending_vtables.
* method.c: Include ggc.h.
(btypelist): Make it a varray. All uses changed.
(ktypelist): Likewise.
(init_method): Add GC roots.
* pt.c: Don't include varray.h. Include ggc.h.
(current_template_parms): Remove.
(processing_template_decl): Likewise.
(processing_specialization): Likewise.
(processing_explicit_instantiation): Likewise.
(init_pt): New function.
* repo.c: Include ggc.h.
(init_repo): Add GC roots.
* search.c: Don't include varray.h.
(_vptr_name): Remove.
(lookup_field_1): Use vtpr_identifier instead.
(expand_indirect_vtbls_init): Remove redundant declaration of
in_charge_identifier.
(init_search_processing): Use vptr_identifier.
From-SVN: r29135
1999-09-06 04:43:09 +02:00
|
|
|
ggc_add_tree_root (&pending_repo, 1);
|
|
|
|
ggc_add_tree_root (&original_repo, 1);
|
|
|
|
|
1995-04-09 13:41:24 +02:00
|
|
|
open_repo_file (filename);
|
1995-04-03 21:28:01 +02:00
|
|
|
|
|
|
|
if (repo_file == 0)
|
|
|
|
return;
|
|
|
|
|
1998-02-02 01:04:13 +01:00
|
|
|
while ((buf = afgets (repo_file)))
|
1995-04-03 21:28:01 +02:00
|
|
|
{
|
|
|
|
switch (buf[0])
|
|
|
|
{
|
|
|
|
case 'A':
|
1997-06-18 04:25:37 +02:00
|
|
|
old_args = obstack_copy0 (&permanent_obstack, buf + 2,
|
|
|
|
strlen (buf + 2));
|
|
|
|
break;
|
1995-04-24 19:27:46 +02:00
|
|
|
case 'D':
|
1997-06-18 04:25:37 +02:00
|
|
|
old_dir = obstack_copy0 (&permanent_obstack, buf + 2,
|
|
|
|
strlen (buf + 2));
|
|
|
|
break;
|
1995-04-03 21:28:01 +02:00
|
|
|
case 'M':
|
1997-06-18 04:25:37 +02:00
|
|
|
old_main = obstack_copy0 (&permanent_obstack, buf + 2,
|
|
|
|
strlen (buf + 2));
|
1995-04-03 21:28:01 +02:00
|
|
|
break;
|
|
|
|
case 'C':
|
|
|
|
case 'O':
|
|
|
|
{
|
1995-04-24 19:27:46 +02:00
|
|
|
tree id = get_identifier (buf + 2);
|
|
|
|
tree orig;
|
1995-04-09 13:41:24 +02:00
|
|
|
|
1995-04-03 21:28:01 +02:00
|
|
|
if (buf[0] == 'C')
|
1995-04-18 21:23:38 +02:00
|
|
|
{
|
|
|
|
IDENTIFIER_REPO_CHOSEN (id) = 1;
|
|
|
|
orig = integer_one_node;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
orig = NULL_TREE;
|
|
|
|
|
1999-09-09 08:17:13 +02:00
|
|
|
original_repo = tree_cons (orig, id, original_repo);
|
1995-04-03 21:28:01 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
1998-09-07 16:25:35 +02:00
|
|
|
error ("mysterious repository information in %s", repo_name);
|
1995-04-03 21:28:01 +02:00
|
|
|
}
|
1995-04-24 19:27:46 +02:00
|
|
|
obstack_free (&temporary_obstack, buf);
|
1995-04-03 21:28:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
reopen_repo_file_for_write ()
|
|
|
|
{
|
|
|
|
if (repo_file)
|
|
|
|
fclose (repo_file);
|
|
|
|
repo_file = fopen (repo_name, "w");
|
|
|
|
|
|
|
|
if (repo_file == 0)
|
|
|
|
{
|
1998-09-07 16:25:35 +02:00
|
|
|
error ("can't create repository information file `%s'", repo_name);
|
1995-04-03 21:28:01 +02:00
|
|
|
flag_use_repository = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Emit any pending repos. */
|
|
|
|
|
|
|
|
void
|
|
|
|
finish_repo ()
|
|
|
|
{
|
|
|
|
tree t;
|
1995-04-09 13:41:24 +02:00
|
|
|
int repo_changed = 0;
|
1997-06-18 04:25:37 +02:00
|
|
|
char *dir, *args;
|
1995-04-03 21:28:01 +02:00
|
|
|
|
|
|
|
if (! flag_use_repository)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Do we have to write out a new info file? */
|
|
|
|
|
1995-04-18 21:23:38 +02:00
|
|
|
/* Are there any old templates that aren't used any longer or that are
|
|
|
|
newly chosen? */
|
1995-04-09 13:41:24 +02:00
|
|
|
|
|
|
|
for (t = original_repo; t; t = TREE_CHAIN (t))
|
|
|
|
{
|
1995-04-18 21:23:38 +02:00
|
|
|
if (! IDENTIFIER_REPO_USED (TREE_VALUE (t))
|
|
|
|
|| (! TREE_PURPOSE (t) && IDENTIFIER_REPO_CHOSEN (TREE_VALUE (t))))
|
1995-04-09 13:41:24 +02:00
|
|
|
{
|
|
|
|
repo_changed = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
IDENTIFIER_REPO_USED (TREE_VALUE (t)) = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Are there any templates that are newly used? */
|
|
|
|
|
|
|
|
if (! repo_changed)
|
|
|
|
for (t = pending_repo; t; t = TREE_CHAIN (t))
|
|
|
|
{
|
|
|
|
if (IDENTIFIER_REPO_USED (TREE_VALUE (t)))
|
|
|
|
{
|
|
|
|
repo_changed = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-06-18 04:25:37 +02:00
|
|
|
dir = getpwd ();
|
|
|
|
args = getenv ("COLLECT_GCC_OPTIONS");
|
|
|
|
|
|
|
|
if (! repo_changed && pending_repo)
|
|
|
|
if (strcmp (old_main, main_input_filename) != 0
|
|
|
|
|| strcmp (old_dir, dir) != 0
|
|
|
|
|| (args == NULL) != (old_args == NULL)
|
1997-08-20 00:49:24 +02:00
|
|
|
|| (args && strcmp (old_args, args) != 0))
|
1997-06-18 04:25:37 +02:00
|
|
|
repo_changed = 1;
|
|
|
|
|
1995-04-03 21:28:01 +02:00
|
|
|
if (! repo_changed || errorcount || sorrycount)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
reopen_repo_file_for_write ();
|
|
|
|
|
|
|
|
if (repo_file == 0)
|
|
|
|
goto out;
|
|
|
|
|
1995-04-04 19:51:34 +02:00
|
|
|
fprintf (repo_file, "M %s\n", main_input_filename);
|
1997-06-18 04:25:37 +02:00
|
|
|
fprintf (repo_file, "D %s\n", dir);
|
|
|
|
if (args)
|
|
|
|
fprintf (repo_file, "A %s\n", args);
|
1995-04-04 19:51:34 +02:00
|
|
|
|
1995-04-03 21:28:01 +02:00
|
|
|
for (t = pending_repo; t; t = TREE_CHAIN (t))
|
|
|
|
{
|
|
|
|
tree val = TREE_VALUE (t);
|
1995-04-09 13:41:24 +02:00
|
|
|
char type = IDENTIFIER_REPO_CHOSEN (val) ? 'C' : 'O';
|
1995-04-03 21:28:01 +02:00
|
|
|
|
1995-04-24 19:27:46 +02:00
|
|
|
fprintf (repo_file, "%c %s\n", type, IDENTIFIER_POINTER (val));
|
1995-04-03 21:28:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
out:
|
|
|
|
if (repo_file)
|
|
|
|
fclose (repo_file);
|
|
|
|
}
|