1995-04-03 15:28:01 -04:00
|
|
|
/* Code to maintain a C++ template repository.
|
1998-11-22 22:12:41 -05:00
|
|
|
Copyright (C) 1995, 96-97, 1998 Free Software Foundation, Inc.
|
1995-04-03 15:28:01 -04: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 08:29:51 -04:00
|
|
|
the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA. */
|
1995-04-03 15:28:01 -04: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 13:51:34 -04:00
|
|
|
explicit code. */
|
1995-04-03 15:28:01 -04:00
|
|
|
|
1995-04-04 13:51:34 -04: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 08:25:46 -05:00
|
|
|
#include "system.h"
|
1995-04-03 15:28:01 -04:00
|
|
|
#include "tree.h"
|
|
|
|
#include "cp-tree.h"
|
|
|
|
#include "input.h"
|
1995-04-09 07:41:24 -04: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 01:01:35 -04:00
|
|
|
#include "toplev.h"
|
1995-04-03 15:28:01 -04:00
|
|
|
|
1997-11-03 18:20:24 -05:00
|
|
|
extern char *getpwd PROTO((void));
|
[multiple changes]
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.
From-SVN: r14868
1997-08-20 20:50:39 -04:00
|
|
|
|
|
|
|
static tree repo_get_id PROTO((tree));
|
|
|
|
static char *extract_string PROTO((char **));
|
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 02:45:00 -05:00
|
|
|
static char *get_base_filename PROTO((const char *));
|
|
|
|
static void open_repo_file PROTO((const char *));
|
[multiple changes]
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.
From-SVN: r14868
1997-08-20 20:50:39 -04:00
|
|
|
static char *afgets PROTO((FILE *));
|
|
|
|
static void reopen_repo_file_for_write PROTO((void));
|
1995-04-03 15:28:01 -04:00
|
|
|
|
|
|
|
static tree pending_repo;
|
1995-04-09 07:41:24 -04:00
|
|
|
static tree original_repo;
|
1995-04-24 13:27:46 -04:00
|
|
|
static char *repo_name;
|
1995-04-03 15:28:01 -04:00
|
|
|
static FILE *repo_file;
|
|
|
|
|
1997-06-17 22:25:37 -04:00
|
|
|
static char *old_args, *old_dir, *old_main;
|
|
|
|
|
1995-04-03 15:28:01 -04:00
|
|
|
extern int flag_use_repository;
|
|
|
|
extern int errorcount, sorrycount;
|
1995-04-24 13:27:46 -04:00
|
|
|
extern struct obstack temporary_obstack;
|
|
|
|
extern struct obstack permanent_obstack;
|
1995-04-03 15:28:01 -04:00
|
|
|
|
|
|
|
#define IDENTIFIER_REPO_USED(NODE) (TREE_LANG_FLAG_3 (NODE))
|
|
|
|
#define IDENTIFIER_REPO_CHOSEN(NODE) (TREE_LANG_FLAG_4 (NODE))
|
|
|
|
|
1996-02-28 17:01:56 -05:00
|
|
|
#if 0
|
1995-04-03 15:28:01 -04: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 17:01:56 -05:00
|
|
|
#endif
|
1995-04-03 15:28:01 -04:00
|
|
|
|
1996-02-28 17:01:56 -05:00
|
|
|
static tree
|
1995-04-18 15:23:38 -04:00
|
|
|
repo_get_id (t)
|
|
|
|
tree t;
|
|
|
|
{
|
|
|
|
if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
|
|
|
|
{
|
1998-11-15 14:24:43 -05: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. */
|
|
|
|
if (TYPE_SIZE (t) == NULL_TREE || TYPE_BEING_DEFINED (t))
|
|
|
|
my_friendly_abort (981113);
|
|
|
|
|
1995-04-18 15:23:38 -04:00
|
|
|
t = TYPE_BINFO_VTABLE (t);
|
|
|
|
if (t == NULL_TREE)
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
return DECL_ASSEMBLER_NAME (t);
|
|
|
|
}
|
|
|
|
|
1995-04-03 15:28:01 -04:00
|
|
|
/* Note that a template has been used. If we can see the definition, offer
|
1996-07-10 21:13:25 -04:00
|
|
|
to emit it. */
|
1995-04-03 15:28:01 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
repo_template_used (t)
|
|
|
|
tree t;
|
|
|
|
{
|
|
|
|
tree id;
|
|
|
|
|
|
|
|
if (! flag_use_repository)
|
|
|
|
return;
|
|
|
|
|
1995-04-18 15:23:38 -04:00
|
|
|
id = repo_get_id (t);
|
|
|
|
if (id == NULL_TREE)
|
|
|
|
return;
|
|
|
|
|
1995-04-03 15:28:01 -04:00
|
|
|
if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
|
|
|
|
{
|
|
|
|
if (IDENTIFIER_REPO_CHOSEN (id))
|
|
|
|
mark_class_instantiated (t, 0);
|
|
|
|
}
|
|
|
|
else if (TREE_CODE_CLASS (TREE_CODE (t)) == 'd')
|
|
|
|
{
|
|
|
|
if (IDENTIFIER_REPO_CHOSEN (id))
|
1996-02-28 17:01:56 -05:00
|
|
|
mark_decl_instantiated (t, 0);
|
1995-04-03 15:28:01 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
my_friendly_abort (1);
|
|
|
|
|
|
|
|
if (! IDENTIFIER_REPO_USED (id))
|
|
|
|
{
|
|
|
|
IDENTIFIER_REPO_USED (id) = 1;
|
1995-04-09 07:41:24 -04:00
|
|
|
pending_repo = perm_tree_cons (NULL_TREE, id, pending_repo);
|
1995-04-03 15:28:01 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1996-02-28 17:01:56 -05:00
|
|
|
#if 0
|
1995-04-03 15:28:01 -04:00
|
|
|
/* Note that the vtable for a class has been used, and offer to emit it. */
|
|
|
|
|
1996-02-28 17:01:56 -05:00
|
|
|
static void
|
1995-04-03 15:28:01 -04:00
|
|
|
repo_vtable_used (t)
|
|
|
|
tree t;
|
|
|
|
{
|
|
|
|
if (! flag_use_repository)
|
|
|
|
return;
|
|
|
|
|
|
|
|
pending_repo = perm_tree_cons (NULL_TREE, t, pending_repo);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 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. */
|
|
|
|
if (DECL_FUNCTION_MEMBER_P (fn) && TYPE_VIRTUAL_P (DECL_CLASS_CONTEXT (fn)))
|
|
|
|
{
|
|
|
|
repo_vtable_used (DECL_CLASS_CONTEXT (fn));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
pending_repo = perm_tree_cons (NULL_TREE, fn, pending_repo);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Note that a particular typeinfo node has been used, and offer to
|
|
|
|
emit it. */
|
|
|
|
|
|
|
|
void
|
|
|
|
repo_tinfo_used (ti)
|
|
|
|
tree ti;
|
|
|
|
{
|
|
|
|
}
|
1996-02-28 17:01:56 -05:00
|
|
|
#endif
|
1995-04-03 15:28:01 -04:00
|
|
|
|
1995-04-18 15:23:38 -04: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-17 22:25:37 -04: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 13:51:34 -04: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 02:45:00 -05:00
|
|
|
const char *filename;
|
1995-04-04 13:51:34 -04:00
|
|
|
{
|
|
|
|
char *p = getenv ("COLLECT_GCC_OPTIONS");
|
1997-06-17 22:25:37 -04:00
|
|
|
char *output = NULL;
|
1995-04-04 13:51:34 -04:00
|
|
|
int compiling = 0;
|
|
|
|
|
1997-06-17 22:25:37 -04:00
|
|
|
while (p && *p)
|
|
|
|
{
|
|
|
|
char *q = extract_string (&p);
|
1995-04-04 13:51:34 -04:00
|
|
|
|
1997-06-17 22:25:37 -04:00
|
|
|
if (strcmp (q, "-o") == 0)
|
|
|
|
output = extract_string (&p);
|
|
|
|
else if (strcmp (q, "-c") == 0)
|
|
|
|
compiling = 1;
|
1995-04-04 13:51:34 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (compiling && output)
|
|
|
|
return output;
|
|
|
|
|
1995-04-09 07:41:24 -04:00
|
|
|
if (p && ! compiling)
|
|
|
|
{
|
1998-09-07 10:25:35 -04:00
|
|
|
warning ("-frepo must be used with -c");
|
1995-04-09 07:41:24 -04:00
|
|
|
flag_use_repository = 0;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1998-07-11 21:53:48 -04:00
|
|
|
return file_name_nondirectory (filename);
|
1995-04-04 13:51:34 -04:00
|
|
|
}
|
|
|
|
|
1995-04-03 15:28:01 -04: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 02:45:00 -05:00
|
|
|
const char *filename;
|
1995-04-03 15:28:01 -04: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 02:45:00 -05:00
|
|
|
register const char *p;
|
|
|
|
const char *s = get_base_filename (filename);
|
1995-04-09 07:41:24 -04:00
|
|
|
|
1995-04-24 13:27:46 -04:00
|
|
|
if (s == NULL)
|
1995-04-09 07:41:24 -04:00
|
|
|
return;
|
|
|
|
|
1998-07-11 21:53:48 -04:00
|
|
|
p = file_name_nondirectory (s);
|
1997-11-03 18:20:24 -05:00
|
|
|
p = rindex (p, '.');
|
1995-04-24 13:27:46 -04:00
|
|
|
if (! p)
|
|
|
|
p = s + strlen (s);
|
1995-04-03 15:28:01 -04:00
|
|
|
|
1995-04-24 13:27:46 -04:00
|
|
|
obstack_grow (&permanent_obstack, s, p - s);
|
|
|
|
repo_name = obstack_copy0 (&permanent_obstack, ".rpo", 4);
|
1995-04-03 15:28:01 -04:00
|
|
|
|
|
|
|
repo_file = fopen (repo_name, "r");
|
|
|
|
}
|
|
|
|
|
1995-04-24 13:27:46 -04: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 15:28:01 -04: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 02:45:00 -05:00
|
|
|
const char *filename;
|
1995-04-03 15:28:01 -04:00
|
|
|
{
|
1995-04-24 13:27:46 -04:00
|
|
|
char *buf;
|
1995-04-03 15:28:01 -04:00
|
|
|
|
|
|
|
if (! flag_use_repository)
|
|
|
|
return;
|
|
|
|
|
1995-04-09 07:41:24 -04:00
|
|
|
open_repo_file (filename);
|
1995-04-03 15:28:01 -04:00
|
|
|
|
|
|
|
if (repo_file == 0)
|
|
|
|
return;
|
|
|
|
|
1998-02-01 19:04:13 -05:00
|
|
|
while ((buf = afgets (repo_file)))
|
1995-04-03 15:28:01 -04:00
|
|
|
{
|
|
|
|
switch (buf[0])
|
|
|
|
{
|
|
|
|
case 'A':
|
1997-06-17 22:25:37 -04:00
|
|
|
old_args = obstack_copy0 (&permanent_obstack, buf + 2,
|
|
|
|
strlen (buf + 2));
|
|
|
|
break;
|
1995-04-24 13:27:46 -04:00
|
|
|
case 'D':
|
1997-06-17 22:25:37 -04:00
|
|
|
old_dir = obstack_copy0 (&permanent_obstack, buf + 2,
|
|
|
|
strlen (buf + 2));
|
|
|
|
break;
|
1995-04-03 15:28:01 -04:00
|
|
|
case 'M':
|
1997-06-17 22:25:37 -04:00
|
|
|
old_main = obstack_copy0 (&permanent_obstack, buf + 2,
|
|
|
|
strlen (buf + 2));
|
1995-04-03 15:28:01 -04:00
|
|
|
break;
|
|
|
|
case 'C':
|
|
|
|
case 'O':
|
|
|
|
{
|
1995-04-24 13:27:46 -04:00
|
|
|
tree id = get_identifier (buf + 2);
|
|
|
|
tree orig;
|
1995-04-09 07:41:24 -04:00
|
|
|
|
1995-04-03 15:28:01 -04:00
|
|
|
if (buf[0] == 'C')
|
1995-04-18 15:23:38 -04:00
|
|
|
{
|
|
|
|
IDENTIFIER_REPO_CHOSEN (id) = 1;
|
|
|
|
orig = integer_one_node;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
orig = NULL_TREE;
|
|
|
|
|
|
|
|
original_repo = perm_tree_cons (orig, id, original_repo);
|
1995-04-03 15:28:01 -04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
1998-09-07 10:25:35 -04:00
|
|
|
error ("mysterious repository information in %s", repo_name);
|
1995-04-03 15:28:01 -04:00
|
|
|
}
|
1995-04-24 13:27:46 -04:00
|
|
|
obstack_free (&temporary_obstack, buf);
|
1995-04-03 15:28:01 -04: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 10:25:35 -04:00
|
|
|
error ("can't create repository information file `%s'", repo_name);
|
1995-04-03 15:28:01 -04:00
|
|
|
flag_use_repository = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Emit any pending repos. */
|
|
|
|
|
|
|
|
void
|
|
|
|
finish_repo ()
|
|
|
|
{
|
|
|
|
tree t;
|
1995-04-09 07:41:24 -04:00
|
|
|
int repo_changed = 0;
|
1997-06-17 22:25:37 -04:00
|
|
|
char *dir, *args;
|
1995-04-03 15:28:01 -04:00
|
|
|
|
|
|
|
if (! flag_use_repository)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Do we have to write out a new info file? */
|
|
|
|
|
1995-04-18 15:23:38 -04:00
|
|
|
/* Are there any old templates that aren't used any longer or that are
|
|
|
|
newly chosen? */
|
1995-04-09 07:41:24 -04:00
|
|
|
|
|
|
|
for (t = original_repo; t; t = TREE_CHAIN (t))
|
|
|
|
{
|
1995-04-18 15:23:38 -04:00
|
|
|
if (! IDENTIFIER_REPO_USED (TREE_VALUE (t))
|
|
|
|
|| (! TREE_PURPOSE (t) && IDENTIFIER_REPO_CHOSEN (TREE_VALUE (t))))
|
1995-04-09 07:41:24 -04: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-17 22:25:37 -04: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-19 18:49:24 -04:00
|
|
|
|| (args && strcmp (old_args, args) != 0))
|
1997-06-17 22:25:37 -04:00
|
|
|
repo_changed = 1;
|
|
|
|
|
1995-04-03 15:28:01 -04:00
|
|
|
if (! repo_changed || errorcount || sorrycount)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
reopen_repo_file_for_write ();
|
|
|
|
|
|
|
|
if (repo_file == 0)
|
|
|
|
goto out;
|
|
|
|
|
1995-04-04 13:51:34 -04:00
|
|
|
fprintf (repo_file, "M %s\n", main_input_filename);
|
1997-06-17 22:25:37 -04:00
|
|
|
fprintf (repo_file, "D %s\n", dir);
|
|
|
|
if (args)
|
|
|
|
fprintf (repo_file, "A %s\n", args);
|
1995-04-04 13:51:34 -04:00
|
|
|
|
1995-04-03 15:28:01 -04:00
|
|
|
for (t = pending_repo; t; t = TREE_CHAIN (t))
|
|
|
|
{
|
|
|
|
tree val = TREE_VALUE (t);
|
1995-04-09 07:41:24 -04:00
|
|
|
char type = IDENTIFIER_REPO_CHOSEN (val) ? 'C' : 'O';
|
1995-04-03 15:28:01 -04:00
|
|
|
|
1995-04-24 13:27:46 -04:00
|
|
|
fprintf (repo_file, "%c %s\n", type, IDENTIFIER_POINTER (val));
|
1995-04-03 15:28:01 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
out:
|
|
|
|
if (repo_file)
|
|
|
|
fclose (repo_file);
|
|
|
|
}
|