aboutsummaryrefslogtreecommitdiff
path: root/gcc/tlink.c
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>1999-09-03 19:13:34 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>1999-09-03 19:13:34 +0000
commitd4058195bd21860bf183e07a8ac033d09ded8e69 (patch)
tree22ab06cab899e64f8be5b78f963f880fe8dbfd60 /gcc/tlink.c
parent2f11d4079a934bae14bc415f5f55fd690ca1187c (diff)
downloadgcc-d4058195bd21860bf183e07a8ac033d09ded8e69.zip
gcc-d4058195bd21860bf183e07a8ac033d09ded8e69.tar.gz
gcc-d4058195bd21860bf183e07a8ac033d09ded8e69.tar.bz2
Makefile.in (tlink.o): Don't depend on toplev.h.
* Makefile.in (tlink.o): Don't depend on toplev.h. * collect2.c (c_file, o_file, export_file, import_file, ldout, output_file, nm_file_name, ldd_file_name, strip_file_name, c_file_name, prefix_list, libexts, is_ctor_dtor, find_a_file, add_prefix, prefix_from_env, prefix_from_string, do_wait, fork_execute, maybe_unlink, add_to_list, extract_init_priority, write_list, dump_list, dump_prefix_list, write_list_with_asm, write_c_file, write_c_file_stat, write_c_file_glob, scan_prog_file, scan_libraries, is_in_list, resolve_lib_name, use_import_list, ignore_library, extract_string, notice, dump_file, target_machine, collect_wait, collect_execute, libname, locatelib, aix_std_libs, read_file, print_load_command): Constify a char*. (fdopen, error, fatal, fatal_perror): Don't prototype. (my_strerror): Remove. All callers use xstrerror instead. (xcalloc, xmalloc, xrealloc, xstrdup, putenv): Remove definitions. (main): Add prototype. Constify lots of char* ptrs. Change calls to xcalloc/strcpy/strcat/... to one call to concat. (main, scan_prog_file, scan_libraries): Use an intermediate `const char **' to build an argv array. (mapfile, libselect, libcompare, locatelib): Add prototypes. * collect2.h (collect_execute, collect_wait, dump_file, file_exists): Constify a char*. (ldout, c_file_name, temporary_obstack, permanent_obstack, temporary_firstobj, vflag, debug): Add extern declarations. (fancy_abort, error, notice, fatal, fatal_perror): Add prototypes. * tlink.c: Don't include toplev.h. (vflag, debug, ldout, c_file_name, temporary_obstack, permanent_obstack, temporary_firstobj): Don't declare. (tlink_execute, frob_extension, symbol_hash_lookup, file_hash_lookup, demangled_hash_lookup, tlink_init, freadsym, recompile_files, read_repo_files, demangle_new_symbols, scan_linker_output): Constify a char*. (symbol_hash_newfunc, file_hash_newfunc, demangled_hash_newfunc, do_tlink): Mark parameters with ATTRIBUTE_UNUSED. From-SVN: r29087
Diffstat (limited to 'gcc/tlink.c')
-rw-r--r--gcc/tlink.c47
1 files changed, 19 insertions, 28 deletions
diff --git a/gcc/tlink.c b/gcc/tlink.c
index 55c66dc..a3df317 100644
--- a/gcc/tlink.c
+++ b/gcc/tlink.c
@@ -25,7 +25,6 @@ Boston, MA 02111-1307, USA. */
#include "system.h"
#include "hash.h"
#include "demangle.h"
-#include "toplev.h"
#include "collect2.h"
#define MAX_ITERATIONS 17
@@ -34,14 +33,6 @@ Boston, MA 02111-1307, USA. */
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
-/* Defined in collect2.c. */
-extern int vflag, debug;
-extern char *ldout;
-extern char *c_file_name;
-extern struct obstack temporary_obstack;
-extern struct obstack permanent_obstack;
-extern char * temporary_firstobj;
-
/* Defined in the automatically-generated underscore.c. */
extern int prepends_underscore;
@@ -95,8 +86,8 @@ static symbol * symbol_pop PARAMS ((void));
static void file_push PARAMS ((file *));
static file * file_pop PARAMS ((void));
static void tlink_init PARAMS ((void));
-static int tlink_execute PARAMS ((char *, char **, char *));
-static char * frob_extension PARAMS ((char *, const char *));
+static int tlink_execute PARAMS ((const char *, char **, const char *));
+static char * frob_extension PARAMS ((const char *, const char *));
static char * obstack_fgets PARAMS ((FILE *, struct obstack *));
static char * tfgets PARAMS ((FILE *));
static char * pfgets PARAMS ((FILE *));
@@ -115,7 +106,7 @@ static struct hash_entry *
symbol_hash_newfunc (entry, table, string)
struct hash_entry *entry;
struct hash_table *table;
- hash_table_key string;
+ hash_table_key string ATTRIBUTE_UNUSED;
{
struct symbol_hash_entry *ret = (struct symbol_hash_entry *) entry;
if (ret == NULL)
@@ -140,7 +131,7 @@ symbol_hash_lookup (string, create)
boolean create;
{
return ((struct symbol_hash_entry *)
- hash_lookup (&symbol_table, (hash_table_key) string,
+ hash_lookup (&symbol_table, (const hash_table_key) string,
create, string_copy));
}
@@ -153,7 +144,7 @@ static struct hash_entry *
file_hash_newfunc (entry, table, string)
struct hash_entry *entry;
struct hash_table *table;
- hash_table_key string;
+ hash_table_key string ATTRIBUTE_UNUSED;
{
struct file_hash_entry *ret = (struct file_hash_entry *) entry;
if (ret == NULL)
@@ -177,7 +168,7 @@ file_hash_lookup (string)
const char *string;
{
return ((struct file_hash_entry *)
- hash_lookup (&file_table, (hash_table_key) string, true,
+ hash_lookup (&file_table, (const hash_table_key) string, true,
string_copy));
}
@@ -190,7 +181,7 @@ static struct hash_entry *
demangled_hash_newfunc (entry, table, string)
struct hash_entry *entry;
struct hash_table *table;
- hash_table_key string;
+ hash_table_key string ATTRIBUTE_UNUSED;
{
struct demangled_hash_entry *ret = (struct demangled_hash_entry *) entry;
if (ret == NULL)
@@ -212,7 +203,7 @@ demangled_hash_lookup (string, create)
boolean create;
{
return ((struct demangled_hash_entry *)
- hash_lookup (&demangled_table, (hash_table_key) string,
+ hash_lookup (&demangled_table, (const hash_table_key) string,
create, string_copy));
}
@@ -296,7 +287,7 @@ file_pop ()
static void
tlink_init ()
{
- char *p;
+ const char *p;
hash_table_init (&symbol_table, symbol_hash_newfunc, string_hash,
string_compare);
@@ -322,9 +313,9 @@ tlink_init ()
static int
tlink_execute (prog, argv, redir)
- char *prog;
+ const char *prog;
char **argv;
- char *redir;
+ const char *redir;
{
collect_execute (prog, argv, redir);
return collect_wait (prog);
@@ -332,10 +323,10 @@ tlink_execute (prog, argv, redir)
static char *
frob_extension (s, ext)
- char *s;
+ const char *s;
const char *ext;
{
- char *p = rindex (s, '/');
+ const char *p = rindex (s, '/');
if (! p)
p = s;
p = rindex (p, '.');
@@ -391,7 +382,7 @@ freadsym (stream, f, chosen)
symbol *sym;
{
- char *name = tfgets (stream);
+ const char *name = tfgets (stream);
sym = symbol_hash_lookup (name, true);
}
@@ -507,7 +498,7 @@ recompile_files ()
{
char *line, *command;
FILE *stream = fopen ((char*) f->root.key, "r");
- char *outname = frob_extension ((char*) f->root.key, ".rnw");
+ const char *outname = frob_extension ((char*) f->root.key, ".rnw");
FILE *output = fopen (outname, "w");
while ((line = tfgets (stream)) != NULL)
@@ -559,7 +550,7 @@ read_repo_files (object_lst)
for (; *object; object++)
{
- char *p = frob_extension (*object, ".rpo");
+ const char *p = frob_extension (*object, ".rpo");
file *f;
if (! file_exists (p))
@@ -586,7 +577,7 @@ demangle_new_symbols ()
while ((sym = symbol_pop ()) != NULL)
{
demangled *dem;
- char *p = cplus_demangle ((char*) sym->root.key,
+ const char *p = cplus_demangle ((char*) sym->root.key,
DMGL_PARAMS | DMGL_ANSI);
if (! p)
@@ -635,7 +626,7 @@ scan_linker_output (fname)
if (! sym && ! end)
/* Try a mangled name in quotes. */
{
- char *oldq = q+1;
+ const char *oldq = q+1;
demangled *dem = 0;
q = 0;
@@ -694,7 +685,7 @@ scan_linker_output (fname)
void
do_tlink (ld_argv, object_lst)
- char **ld_argv, **object_lst;
+ char **ld_argv, **object_lst ATTRIBUTE_UNUSED;
{
int exit = tlink_execute ("ld", ld_argv, ldout);