Commit 159b3be1 by Andreas Jaeger Committed by Andreas Jaeger

collect2.h: Convert prototypes to ISO C90.

	* collect2.h: Convert prototypes to ISO C90.
	* collect2.c: Likewise.
	* conflict.c: Likewise.
	* coverage.c: Likewise.
	* convert.h: Likewise.
	* convert.c: Likewise.

From-SVN: r68669
parent 4e3f84b7
2003-06-29 Andreas Jaeger <aj@suse.de>
* collect2.h: Convert prototypes to ISO C90.
* collect2.c: Likewise.
* conflict.c: Likewise.
* coverage.c: Likewise.
* convert.h: Likewise.
* convert.c: Likewise.
2003-06-29 Nathan Sidwell <nathan@codesourcery.com>
* c-decl.c (c_init_decl_processing): Use a location_t. Set input
......
......@@ -264,53 +264,50 @@ static struct path_prefix *libpaths[3] = {&cmdline_lib_dirs,
static const char *const libexts[3] = {"a", "so", NULL}; /* possible library extensions */
#endif
static void handler PARAMS ((int));
static int is_ctor_dtor PARAMS ((const char *));
static char *find_a_file PARAMS ((struct path_prefix *, const char *));
static void add_prefix PARAMS ((struct path_prefix *, const char *));
static void prefix_from_env PARAMS ((const char *, struct path_prefix *));
static void prefix_from_string PARAMS ((const char *, struct path_prefix *));
static void do_wait PARAMS ((const char *));
static void fork_execute PARAMS ((const char *, char **));
static void maybe_unlink PARAMS ((const char *));
static void add_to_list PARAMS ((struct head *, const char *));
static int extract_init_priority PARAMS ((const char *));
static void sort_ids PARAMS ((struct head *));
static void write_list PARAMS ((FILE *, const char *, struct id *));
static void handler (int);
static int is_ctor_dtor (const char *);
static char *find_a_file (struct path_prefix *, const char *);
static void add_prefix (struct path_prefix *, const char *);
static void prefix_from_env (const char *, struct path_prefix *);
static void prefix_from_string (const char *, struct path_prefix *);
static void do_wait (const char *);
static void fork_execute (const char *, char **);
static void maybe_unlink (const char *);
static void add_to_list (struct head *, const char *);
static int extract_init_priority (const char *);
static void sort_ids (struct head *);
static void write_list (FILE *, const char *, struct id *);
#ifdef COLLECT_EXPORT_LIST
static void dump_list PARAMS ((FILE *, const char *, struct id *));
static void dump_list (FILE *, const char *, struct id *);
#endif
#if 0
static void dump_prefix_list PARAMS ((FILE *, const char *, struct prefix_list *));
static void dump_prefix_list (FILE *, const char *, struct prefix_list *);
#endif
static void write_list_with_asm PARAMS ((FILE *, const char *, struct id *));
static void write_c_file PARAMS ((FILE *, const char *));
static void write_c_file_stat PARAMS ((FILE *, const char *));
static void write_list_with_asm (FILE *, const char *, struct id *);
static void write_c_file (FILE *, const char *);
static void write_c_file_stat (FILE *, const char *);
#ifndef LD_INIT_SWITCH
static void write_c_file_glob PARAMS ((FILE *, const char *));
static void write_c_file_glob (FILE *, const char *);
#endif
static void scan_prog_file PARAMS ((const char *, enum pass));
static void scan_prog_file (const char *, enum pass);
#ifdef SCAN_LIBRARIES
static void scan_libraries PARAMS ((const char *));
static void scan_libraries (const char *);
#endif
#if LINK_ELIMINATE_DUPLICATE_LDIRECTORIES
static int is_in_args PARAMS ((const char *, const char **, const char **));
static int is_in_args (const char *, const char **, const char **);
#endif
#ifdef COLLECT_EXPORT_LIST
#if 0
static int is_in_list PARAMS ((const char *, struct id *));
static int is_in_list (const char *, struct id *);
#endif
static void write_aix_file PARAMS ((FILE *, struct id *));
static char *resolve_lib_name PARAMS ((const char *));
static void write_aix_file (FILE *, struct id *);
static char *resolve_lib_name (const char *);
#endif
static char *extract_string PARAMS ((const char **));
static char *extract_string (const char **);
#ifndef HAVE_DUP2
static int dup2 PARAMS ((int, int));
static int
dup2 (oldfd, newfd)
int oldfd;
int newfd;
dup2 (int oldfd, int newfd)
{
int fdtmp[256];
int fdx = 0;
......@@ -331,8 +328,7 @@ dup2 (oldfd, newfd)
/* Delete tempfiles and exit function. */
void
collect_exit (status)
int status;
collect_exit (int status)
{
if (c_file != 0 && c_file[0])
maybe_unlink (c_file);
......@@ -420,14 +416,13 @@ error (const char * msgid, ...)
provide a default entry. */
void
fancy_abort ()
fancy_abort (void)
{
fatal ("internal error");
}
static void
handler (signo)
int signo;
handler (int signo)
{
if (c_file != 0 && c_file[0])
maybe_unlink (c_file);
......@@ -449,8 +444,7 @@ handler (signo)
int
file_exists (name)
const char *name;
file_exists (const char *name)
{
return access (name, R_OK) == 0;
}
......@@ -458,8 +452,7 @@ file_exists (name)
/* Parse a reasonable subset of shell quoting syntax. */
static char *
extract_string (pp)
const char **pp;
extract_string (const char **pp)
{
const char *p = *pp;
int backquote = 0;
......@@ -489,8 +482,7 @@ extract_string (pp)
}
void
dump_file (name)
const char *name;
dump_file (const char *name)
{
FILE *stream = fopen (name, "r");
......@@ -552,8 +544,7 @@ dump_file (name)
nothing special (0). */
static int
is_ctor_dtor (s)
const char *s;
is_ctor_dtor (const char *s)
{
struct names { const char *const name; const int len; const int ret;
const int two_underscores; };
......@@ -616,9 +607,7 @@ static const char *const target_machine = TARGET_MACHINE;
Return 0 if not found, otherwise return its name, allocated with malloc. */
static char *
find_a_file (pprefix, name)
struct path_prefix *pprefix;
const char *name;
find_a_file (struct path_prefix *pprefix, const char *name)
{
char *temp;
struct prefix_list *pl;
......@@ -699,9 +688,7 @@ find_a_file (pprefix, name)
/* Add an entry for PREFIX to prefix list PPREFIX. */
static void
add_prefix (pprefix, prefix)
struct path_prefix *pprefix;
const char *prefix;
add_prefix (struct path_prefix *pprefix, const char *prefix)
{
struct prefix_list *pl, **prev;
int len;
......@@ -735,9 +722,7 @@ add_prefix (pprefix, prefix)
add of the entries to PPREFIX. */
static void
prefix_from_env (env, pprefix)
const char *env;
struct path_prefix *pprefix;
prefix_from_env (const char *env, struct path_prefix *pprefix)
{
const char *p;
GET_ENVIRONMENT (p, env);
......@@ -747,9 +732,7 @@ prefix_from_env (env, pprefix)
}
static void
prefix_from_string (p, pprefix)
const char *p;
struct path_prefix *pprefix;
prefix_from_string (const char *p, struct path_prefix *pprefix)
{
const char *startp, *endp;
char *nstore = (char *) xmalloc (strlen (p) + 3);
......@@ -790,11 +773,8 @@ prefix_from_string (p, pprefix)
/* Main program. */
int main PARAMS ((int, char *[]));
int
main (argc, argv)
int argc;
char *argv[];
main (int argc, char **argv)
{
static const char *const ld_suffix = "ld";
static const char *const real_ld_suffix = "real-ld";
......@@ -1486,8 +1466,7 @@ main (argc, argv)
/* Wait for a process to finish, and exit if a nonzero status is found. */
int
collect_wait (prog)
const char *prog;
collect_wait (const char *prog)
{
int status;
......@@ -1510,8 +1489,7 @@ collect_wait (prog)
}
static void
do_wait (prog)
const char *prog;
do_wait (const char *prog)
{
int ret = collect_wait (prog);
if (ret != 0)
......@@ -1525,10 +1503,7 @@ do_wait (prog)
/* Execute a program, and wait for the reply. */
void
collect_execute (prog, argv, redir)
const char *prog;
char **argv;
const char *redir;
collect_execute (const char *prog, char **argv, const char *redir)
{
char *errmsg_fmt;
char *errmsg_arg;
......@@ -1598,9 +1573,7 @@ collect_execute (prog, argv, redir)
}
static void
fork_execute (prog, argv)
const char *prog;
char **argv;
fork_execute (const char *prog, char **argv)
{
collect_execute (prog, argv, NULL);
do_wait (prog);
......@@ -1609,8 +1582,7 @@ fork_execute (prog, argv)
/* Unlink a file unless we are debugging. */
static void
maybe_unlink (file)
const char *file;
maybe_unlink (const char *file)
{
if (!debug)
unlink (file);
......@@ -1624,9 +1596,7 @@ static long sequence_number = 0;
/* Add a name to a linked list. */
static void
add_to_list (head_ptr, name)
struct head *head_ptr;
const char *name;
add_to_list (struct head *head_ptr, const char *name)
{
struct id *newid
= (struct id *) xcalloc (sizeof (struct id) + strlen (name), 1);
......@@ -1659,8 +1629,7 @@ add_to_list (head_ptr, name)
looks like "_GLOBAL_.I.12345.foo". */
static int
extract_init_priority (name)
const char *name;
extract_init_priority (const char *name)
{
int pos = 0, pri;
......@@ -1677,8 +1646,7 @@ extract_init_priority (name)
ctors will be run from right to left, dtors from left to right. */
static void
sort_ids (head_ptr)
struct head *head_ptr;
sort_ids (struct head *head_ptr)
{
/* id holds the current element to insert. id_next holds the next
element to insert. id_ptr iterates through the already sorted elements
......@@ -1719,10 +1687,7 @@ sort_ids (head_ptr)
/* Write: `prefix', the names on list LIST, `suffix'. */
static void
write_list (stream, prefix, list)
FILE *stream;
const char *prefix;
struct id *list;
write_list (FILE *stream, const char *prefix, struct id *list)
{
while (list)
{
......@@ -1736,10 +1701,8 @@ write_list (stream, prefix, list)
[ARGS_BEGIN,ARGS_END). */
static int
is_in_args (string, args_begin, args_end)
const char *string;
const char **args_begin;
const char **args_end;
is_in_args (const char *string, const char **args_begin,
const char **args_end)
{
const char **args_pointer;
for (args_pointer = args_begin; args_pointer != args_end; ++args_pointer)
......@@ -1753,9 +1716,7 @@ is_in_args (string, args_begin, args_end)
/* This function is really used only on AIX, but may be useful. */
#if 0
static int
is_in_list (prefix, list)
const char *prefix;
struct id *list;
is_in_list (const char *prefix, struct id *list)
{
while (list)
{
......@@ -1770,10 +1731,7 @@ is_in_list (prefix, list)
/* Added for debugging purpose. */
#ifdef COLLECT_EXPORT_LIST
static void
dump_list (stream, prefix, list)
FILE *stream;
const char *prefix;
struct id *list;
dump_list (FILE *stream, const char *prefix, struct id *list)
{
while (list)
{
......@@ -1785,10 +1743,7 @@ dump_list (stream, prefix, list)
#if 0
static void
dump_prefix_list (stream, prefix, list)
FILE *stream;
const char *prefix;
struct prefix_list *list;
dump_prefix_list (FILE *stream, const char *prefix, struct prefix_list *list)
{
while (list)
{
......@@ -1799,10 +1754,7 @@ dump_prefix_list (stream, prefix, list)
#endif
static void
write_list_with_asm (stream, prefix, list)
FILE *stream;
const char *prefix;
struct id *list;
write_list_with_asm (FILE *stream, const char *prefix, struct id *list)
{
while (list)
{
......@@ -1816,9 +1768,7 @@ write_list_with_asm (stream, prefix, list)
object), along with the functions to execute them. */
static void
write_c_file_stat (stream, name)
FILE *stream;
const char *name ATTRIBUTE_UNUSED;
write_c_file_stat (FILE *stream, const char *name ATTRIBUTE_UNUSED)
{
const char *p, *q;
char *prefix, *r;
......@@ -1947,9 +1897,7 @@ write_c_file_stat (stream, name)
#ifndef LD_INIT_SWITCH
static void
write_c_file_glob (stream, name)
FILE *stream;
const char *name ATTRIBUTE_UNUSED;
write_c_file_glob (FILE *stream, const char *name ATTRIBUTE_UNUSED)
{
/* Write the tables as C code */
......@@ -2012,9 +1960,7 @@ write_c_file_glob (stream, name)
#endif /* ! LD_INIT_SWITCH */
static void
write_c_file (stream, name)
FILE *stream;
const char *name;
write_c_file (FILE *stream, const char *name)
{
fprintf (stream, "#ifdef __cplusplus\nextern \"C\" {\n#endif\n");
#ifndef LD_INIT_SWITCH
......@@ -2028,9 +1974,7 @@ write_c_file (stream, name)
#ifdef COLLECT_EXPORT_LIST
static void
write_aix_file (stream, list)
FILE *stream;
struct id *list;
write_aix_file (FILE *stream, struct id *list)
{
for (; list; list = list->next)
{
......@@ -2052,12 +1996,10 @@ write_aix_file (stream, list)
destructor table has the same format, and begins at __DTOR_LIST__. */
static void
scan_prog_file (prog_name, which_pass)
const char *prog_name;
enum pass which_pass;
scan_prog_file (const char *prog_name, enum pass which_pass)
{
void (*int_handler) PARAMS ((int));
void (*quit_handler) PARAMS ((int));
void (*int_handler) (int);
void (*quit_handler) (int);
char *real_nm_argv[4];
const char **nm_argv = (const char **) real_nm_argv;
int argc = 0;
......@@ -2123,9 +2065,9 @@ scan_prog_file (prog_name, which_pass)
}
/* Parent context from here on. */
int_handler = (void (*) PARAMS ((int))) signal (SIGINT, SIG_IGN);
int_handler = (void (*) (int)) signal (SIGINT, SIG_IGN);
#ifdef SIGQUIT
quit_handler = (void (*) PARAMS ((int))) signal (SIGQUIT, SIG_IGN);
quit_handler = (void (*) (int)) signal (SIGQUIT, SIG_IGN);
#endif
if (close (pipe_fd[1]) < 0)
......@@ -2240,11 +2182,8 @@ struct head libraries;
/* Map the file indicated by NAME into memory and store its address. */
static void mapfile PARAMS ((const char *));
static void
mapfile (name)
const char *name;
mapfile (const char *name)
{
int fp;
struct stat s;
......@@ -2266,11 +2205,8 @@ mapfile (name)
static const char *libname;
static int libselect PARAMS ((struct direct *));
static int
libselect (d)
struct direct *d;
libselect (struct direct *d)
{
return (strncmp (libname, d->d_name, strlen (libname)) == 0);
}
......@@ -2282,11 +2218,9 @@ libselect (d)
We must verify that the extension is numeric, because Sun saves the
original versions of patched libraries with a .FCS extension. Files with
invalid extensions must go last in the sort, so that they will not be used. */
static int libcompare PARAMS ((struct direct **, struct direct **));
static int
libcompare (d1, d2)
struct direct **d1, **d2;
libcompare (struct direct **d1, struct direct **d2)
{
int i1, i2 = strlen (libname);
char *e1 = (*d1)->d_name + i2;
......@@ -2327,11 +2261,9 @@ libcompare (d1, d2)
/* Given the name NAME of a dynamic dependency, find its pathname and add
it to the list of libraries. */
static void locatelib PARAMS ((const char *));
static void
locatelib (name)
const char *name;
locatelib (const char *name)
{
static const char **l;
static int cnt;
......@@ -2420,8 +2352,7 @@ locatelib (name)
that it depends upon and any constructors or destructors they contain. */
static void
scan_libraries (prog_name)
const char *prog_name;
scan_libraries (const char *prog_name)
{
struct exec *header;
char *base;
......@@ -2495,13 +2426,12 @@ scan_libraries (prog_name)
routines, if any. */
static void
scan_libraries (prog_name)
const char *prog_name;
scan_libraries (const char *prog_name)
{
static struct head libraries; /* list of shared libraries found */
struct id *list;
void (*int_handler) PARAMS ((int));
void (*quit_handler) PARAMS ((int));
void (*int_handler) (int);
void (*quit_handler) (int);
char *real_ldd_argv[4];
const char **ldd_argv = (const char **) real_ldd_argv;
int argc = 0;
......@@ -2564,9 +2494,9 @@ scan_libraries (prog_name)
}
/* Parent context from here on. */
int_handler = (void (*) PARAMS ((int))) signal (SIGINT, SIG_IGN);
int_handler = (void (*) (int))) signal (SIGINT, SIG_IGN;
#ifdef SIGQUIT
quit_handler = (void (*) PARAMS ((int))) signal (SIGQUIT, SIG_IGN);
quit_handler = (void (*) (int))) signal (SIGQUIT, SIG_IGN;
#endif
if (close (pipe_fd[1]) < 0)
......@@ -2696,10 +2626,9 @@ static const char *const aix_std_libs[] = {
/* This function checks the filename and returns 1
if this name matches the location of a standard AIX library. */
static int ignore_library PARAMS ((const char *));
static int ignore_library (const char *);
static int
ignore_library (name)
const char *name;
ignore_library (const char *name)
{
const char *const *p = &aix_std_libs[0];
while (*p++ != NULL)
......@@ -2709,7 +2638,7 @@ ignore_library (name)
#endif /* COLLECT_EXPORT_LIST */
#if defined (HAVE_DECL_LDGETNAME) && !HAVE_DECL_LDGETNAME
extern char *ldgetname PARAMS ((LDFILE *, GCC_SYMENT *));
extern char *ldgetname (LDFILE *, GCC_SYMENT *);
#endif
/* COFF version to scan the name list of the loaded program for
......@@ -2722,9 +2651,7 @@ extern char *ldgetname PARAMS ((LDFILE *, GCC_SYMENT *));
destructor table has the same format, and begins at __DTOR_LIST__. */
static void
scan_prog_file (prog_name, which_pass)
const char *prog_name;
enum pass which_pass;
scan_prog_file (const char *prog_name, enum pass which_pass)
{
LDFILE *ldptr = NULL;
int sym_index, sym_count;
......@@ -2887,8 +2814,7 @@ scan_prog_file (prog_name, which_pass)
/* Given a library name without "lib" prefix, this function
returns a full library name including a path. */
static char *
resolve_lib_name (name)
const char *name;
resolve_lib_name (const char *name)
{
char *lib_buf;
int i, j, l = 0;
......@@ -2976,16 +2902,16 @@ struct file_info
int use_mmap; /* != 0 if mmap'ed */
};
extern int decode_mach_o_hdr ();
extern int encode_mach_o_hdr ();
extern int decode_mach_o_hdr (void);
extern int encode_mach_o_hdr (void);
static void add_func_table PARAMS ((mo_header_t *, load_all_t *,
symbol_info_t *, int));
static void print_header PARAMS ((mo_header_t *));
static void print_load_command PARAMS ((load_union_t *, size_t, int));
static void bad_header PARAMS ((int));
static struct file_info *read_file PARAMS ((const char *, int, int));
static void end_file PARAMS ((struct file_info *));
static void add_func_table (mo_header_t *, load_all_t *, symbol_info_t *,
int);
static void print_header (mo_header_t *);
static void print_load_command (load_union_t *, size_t, int);
static void bad_header (int);
static struct file_info *read_file (const char *, int, int);
static void end_file (struct file_info *);
/* OSF/rose specific version to scan the name list of the loaded
program for the symbols g++ uses for static constructors and
......@@ -2998,9 +2924,7 @@ static void end_file PARAMS ((struct file_info *));
destructor table has the same format, and begins at __DTOR_LIST__. */
static void
scan_prog_file (prog_name, which_pass)
const char *prog_name;
enum pass which_pass;
scan_prog_file (const char *prog_name, enum pass which_pass)
{
char *obj;
mo_header_t hdr;
......@@ -3267,15 +3191,15 @@ scan_prog_file (prog_name, which_pass)
}
/* Add a function table to the load commands to call a function
on initiation or termination of the process. */
/* Add a function table to the load commands to call a function on
initiation or termination of the process. The function takes HDR_P
as pointer to the global header, LOAD_ARRAY as array of pointers to
load commands, SYM as pointer to symbol entry and the fntc_type
value TYPE. */
static void
add_func_table (hdr_p, load_array, sym, type)
mo_header_t *hdr_p; /* pointer to global header */
load_all_t *load_array; /* array of ptrs to load cmds */
symbol_info_t *sym; /* pointer to symbol entry */
int type; /* fntc_type value */
add_func_table (mo_header_t *hdr_p, load_all_t *load_array,
symbol_info_t *sym, int type)
{
/* Add a new load command. */
int num_cmds = ++hdr_p->moh_n_load_cmds;
......@@ -3350,8 +3274,7 @@ add_func_table (hdr_p, load_array, sym, type)
/* Print the global header for an OSF/rose object. */
static void
print_header (hdr_ptr)
mo_header_t *hdr_ptr;
print_header (mo_header_t *hdr_ptr)
{
fprintf (stderr, "\nglobal header:\n");
fprintf (stderr, "\tmoh_magic = 0x%.8lx\n", hdr_ptr->moh_magic);
......@@ -3393,10 +3316,7 @@ print_header (hdr_ptr)
/* Print a short summary of a load command. */
static void
print_load_command (load_hdr, offset, number)
load_union_t *load_hdr;
size_t offset;
int number;
print_load_command (load_union_t *load_hdr, size_t offset, int number)
{
mo_long_t type = load_hdr->hdr.ldci_cmd_type;
const char *type_str = (char *) 0;
......@@ -3460,8 +3380,7 @@ print_load_command (load_hdr, offset, number)
/* Fatal error when {en,de}code_mach_o_header fails. */
static void
bad_header (status)
int status;
bad_header (int status)
{
switch (status)
{
......@@ -3477,13 +3396,12 @@ bad_header (status)
}
/* Read a file into a memory buffer. */
/* Read a file into a memory buffer. The file has filename NAME and is
opened with the file descriptor FD for read or write according to
RW. */
static struct file_info *
read_file (name, fd, rw)
const char *name; /* filename */
int fd; /* file descriptor */
int rw; /* read/write */
read_file (const char *name, int fd, int rw)
{
struct stat stat_pkt;
struct file_info *p = (struct file_info *) xcalloc (sizeof (struct file_info), 1);
......@@ -3545,8 +3463,7 @@ read_file (name, fd, rw)
/* Do anything necessary to write a file back from memory. */
static void
end_file (ptr)
struct file_info *ptr; /* file information block */
end_file (struct file_info *pt)
{
#ifdef USE_MMAP
if (ptr->use_mmap)
......
/* Header file for collect/tlink routines.
Copyright (C) 1998 Free Software Foundation, Inc.
Copyright (C) 1998, 2003 Free Software Foundation, Inc.
This file is part of GCC.
......@@ -21,17 +21,17 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#ifndef GCC_COLLECT2_H
#define GCC_COLLECT2_H
extern void do_tlink PARAMS ((char **, char **));
extern void do_tlink (char **, char **);
extern void collect_execute PARAMS ((const char *, char **, const char *));
extern void collect_execute (const char *, char **, const char *);
extern void collect_exit PARAMS ((int)) ATTRIBUTE_NORETURN;
extern void collect_exit (int) ATTRIBUTE_NORETURN;
extern int collect_wait PARAMS ((const char *));
extern int collect_wait (const char *);
extern void dump_file PARAMS ((const char *));
extern void dump_file (const char *);
extern int file_exists PARAMS ((const char *));
extern int file_exists (const char *);
extern const char *ldout;
extern const char *c_file_name;
......@@ -39,12 +39,11 @@ extern struct obstack temporary_obstack;
extern char *temporary_firstobj;
extern int vflag, debug;
extern void fancy_abort PARAMS ((void)) ATTRIBUTE_NORETURN;
extern void error PARAMS ((const char *, ...)) ATTRIBUTE_PRINTF_1;
extern void notice PARAMS ((const char *, ...)) ATTRIBUTE_PRINTF_1;
extern void fatal PARAMS ((const char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
extern void fatal_perror PARAMS ((const char *, ...))
extern void fancy_abort (void) ATTRIBUTE_NORETURN;
extern void error (const char *, ...) ATTRIBUTE_PRINTF_1;
extern void notice (const char *, ...) ATTRIBUTE_PRINTF_1;
extern void fatal (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
extern void fatal_perror (const char *, ...)
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
#endif /* ! GCC_COLLECT2_H */
/* Register conflict graph computation routines.
Copyright (C) 2000 Free Software Foundation, Inc.
Copyright (C) 2000, 2003 Free Software Foundation, Inc.
Contributed by CodeSourcery, LLC
This file is part of GCC.
......@@ -114,17 +114,16 @@ struct conflict_graph_def
R1 and R2. R1 is assumed to be smaller or equal to R2. */
#define CONFLICT_HASH_FN(R1, R2) ((R2) * ((R2) - 1) / 2 + (R1))
static hashval_t arc_hash PARAMS ((const void *));
static int arc_eq PARAMS ((const void *, const void *));
static int print_conflict PARAMS ((int, int, void *));
static void mark_reg PARAMS ((rtx, rtx, void *));
static hashval_t arc_hash (const void *);
static int arc_eq (const void *, const void *);
static int print_conflict (int, int, void *);
static void mark_reg (rtx, rtx, void *);
/* Callback function to compute the hash value of an arc. Uses
current_graph to locate the graph to which the arc belongs. */
static hashval_t
arc_hash (arcp)
const void *arcp;
arc_hash (const void *arcp)
{
const_conflict_graph_arc arc = (const_conflict_graph_arc) arcp;
......@@ -135,9 +134,7 @@ arc_hash (arcp)
table. */
static int
arc_eq (arcp1, arcp2)
const void *arcp1;
const void *arcp2;
arc_eq (const void *arcp1, const void *arcp2)
{
const_conflict_graph_arc arc1 = (const_conflict_graph_arc) arcp1;
const_conflict_graph_arc arc2 = (const_conflict_graph_arc) arcp2;
......@@ -149,8 +146,7 @@ arc_eq (arcp1, arcp2)
registers. */
conflict_graph
conflict_graph_new (num_regs)
int num_regs;
conflict_graph_new (int num_regs)
{
conflict_graph graph
= (conflict_graph) xmalloc (sizeof (struct conflict_graph_def));
......@@ -175,8 +171,7 @@ conflict_graph_new (num_regs)
/* Deletes a conflict graph. */
void
conflict_graph_delete (graph)
conflict_graph graph;
conflict_graph_delete (conflict_graph graph)
{
obstack_free (&graph->arc_obstack, NULL);
htab_delete (graph->arc_hash_table);
......@@ -189,10 +184,7 @@ conflict_graph_delete (graph)
in GRAPH, in which case it does nothing and returns zero. */
int
conflict_graph_add (graph, reg1, reg2)
conflict_graph graph;
int reg1;
int reg2;
conflict_graph_add (conflict_graph graph, int reg1, int reg2)
{
int smaller = MIN (reg1, reg2);
int larger = MAX (reg1, reg2);
......@@ -238,10 +230,7 @@ conflict_graph_add (graph, reg1, reg2)
and REG2. */
int
conflict_graph_conflict_p (graph, reg1, reg2)
conflict_graph graph;
int reg1;
int reg2;
conflict_graph_conflict_p (conflict_graph graph, int reg1, int reg2)
{
/* Build an arc to search for. */
struct conflict_graph_arc_def arc;
......@@ -255,11 +244,8 @@ conflict_graph_conflict_p (graph, reg1, reg2)
passed back to ENUM_FN. */
void
conflict_graph_enum (graph, reg, enum_fn, extra)
conflict_graph graph;
int reg;
conflict_graph_enum_fn enum_fn;
void *extra;
conflict_graph_enum (conflict_graph graph, int reg,
conflict_graph_enum_fn enum_fn, void *extra)
{
conflict_graph_arc arc = graph->neighbor_heads[reg];
while (arc != NULL)
......@@ -282,10 +268,7 @@ conflict_graph_enum (graph, reg, enum_fn, extra)
conflict to GRAPH between x and TARGET. */
void
conflict_graph_merge_regs (graph, target, src)
conflict_graph graph;
int target;
int src;
conflict_graph_merge_regs (conflict_graph graph, int target, int src)
{
conflict_graph_arc arc = graph->neighbor_heads[src];
......@@ -328,10 +311,7 @@ struct print_context
/* Callback function when enumerating conflicts during printing. */
static int
print_conflict (reg1, reg2, contextp)
int reg1;
int reg2;
void *contextp;
print_conflict (int reg1, int reg2, void *contextp)
{
struct print_context *context = (struct print_context *) contextp;
int reg;
......@@ -363,9 +343,7 @@ print_conflict (reg1, reg2, contextp)
/* Prints the conflicts in GRAPH to FP. */
void
conflict_graph_print (graph, fp)
conflict_graph graph;
FILE *fp;
conflict_graph_print (conflict_graph graph, FILE *fp)
{
int reg;
struct print_context context;
......@@ -394,10 +372,7 @@ conflict_graph_print (graph, fp)
/* Callback function for note_stores. */
static void
mark_reg (reg, setter, data)
rtx reg;
rtx setter ATTRIBUTE_UNUSED;
void *data;
mark_reg (rtx reg, rtx setter ATTRIBUTE_UNUSED, void *data)
{
regset set = (regset) data;
......@@ -441,9 +416,7 @@ mark_reg (reg, setter, data)
canonical regs instead. */
conflict_graph
conflict_graph_compute (regs, p)
regset regs;
partition p;
conflict_graph_compute (regset regs, partition p)
{
conflict_graph graph = conflict_graph_new (max_reg_num ());
regset_head live_head;
......
......@@ -39,8 +39,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
in other cases error is called. */
tree
convert_to_pointer (type, expr)
tree type, expr;
convert_to_pointer (tree type, tree expr)
{
if (integer_zerop (expr))
{
......@@ -75,8 +74,7 @@ convert_to_pointer (type, expr)
/* Avoid any floating point extensions from EXP. */
tree
strip_float_extensions (exp)
tree exp;
strip_float_extensions (tree exp)
{
tree sub, expt, subt;
......@@ -124,8 +122,7 @@ strip_float_extensions (exp)
in other cases error is called. */
tree
convert_to_real (type, expr)
tree type, expr;
convert_to_real (tree type, tree expr)
{
enum built_in_function fcode = builtin_mathfn_code (expr);
tree itype = TREE_TYPE (expr);
......@@ -285,8 +282,7 @@ convert_to_real (type, expr)
not in use in any existing structure. */
tree
convert_to_integer (type, expr)
tree type, expr;
convert_to_integer (tree type, tree expr)
{
enum tree_code ex_form = TREE_CODE (expr);
tree intype = TREE_TYPE (expr);
......@@ -593,8 +589,7 @@ convert_to_integer (type, expr)
/* Convert EXPR to the complex type TYPE in the usual ways. */
tree
convert_to_complex (type, expr)
tree type, expr;
convert_to_complex (tree type, tree expr)
{
tree subtype = TREE_TYPE (type);
......@@ -649,8 +644,7 @@ convert_to_complex (type, expr)
/* Convert EXPR to the vector type TYPE in the usual ways. */
tree
convert_to_vector (type, expr)
tree type, expr;
convert_to_vector (tree type, tree expr)
{
switch (TREE_CODE (TREE_TYPE (expr)))
{
......
/* Definition of functions in convert.c.
Copyright (C) 1993, 2000 Free Software Foundation, Inc.
Copyright (C) 1993, 2000, 2003 Free Software Foundation, Inc.
This file is part of GCC.
......@@ -18,8 +18,8 @@ along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
extern tree convert_to_integer PARAMS ((tree, tree));
extern tree convert_to_pointer PARAMS ((tree, tree));
extern tree convert_to_real PARAMS ((tree, tree));
extern tree convert_to_complex PARAMS ((tree, tree));
extern tree convert_to_vector PARAMS ((tree, tree));
extern tree convert_to_integer (tree, tree);
extern tree convert_to_pointer (tree, tree);
extern tree convert_to_real (tree, tree);
extern tree convert_to_complex (tree, tree);
extern tree convert_to_vector (tree, tree);
......@@ -104,23 +104,22 @@ static const char *const ctr_merge_functions[GCOV_COUNTERS] = GCOV_MERGE_FUNCTIO
static const char *const ctr_names[GCOV_COUNTERS] = GCOV_COUNTER_NAMES;
/* Forward declarations. */
static hashval_t htab_counts_entry_hash PARAMS ((const void *));
static int htab_counts_entry_eq PARAMS ((const void *, const void *));
static void htab_counts_entry_del PARAMS ((void *));
static void read_counts_file PARAMS ((void));
static unsigned compute_checksum PARAMS ((void));
static unsigned checksum_string PARAMS ((unsigned, const char *));
static tree build_fn_info_type PARAMS ((unsigned));
static tree build_fn_info_value PARAMS ((const struct function_list *, tree));
static tree build_ctr_info_type PARAMS ((void));
static tree build_ctr_info_value PARAMS ((unsigned, tree));
static tree build_gcov_info PARAMS ((void));
static void create_coverage PARAMS ((void));
static hashval_t htab_counts_entry_hash (const void *);
static int htab_counts_entry_eq (const void *, const void *);
static void htab_counts_entry_del (void *);
static void read_counts_file (void);
static unsigned compute_checksum (void);
static unsigned checksum_string (unsigned, const char *);
static tree build_fn_info_type (unsigned);
static tree build_fn_info_value (const struct function_list *, tree);
static tree build_ctr_info_type (void);
static tree build_ctr_info_value (unsigned, tree);
static tree build_gcov_info (void);
static void create_coverage (void);
static hashval_t
htab_counts_entry_hash (of)
const void *of;
htab_counts_entry_hash (const void *of)
{
const counts_entry_t *entry = of;
......@@ -128,9 +127,7 @@ htab_counts_entry_hash (of)
}
static int
htab_counts_entry_eq (of1, of2)
const void *of1;
const void *of2;
htab_counts_entry_eq (const void *of1, const void *of2)
{
const counts_entry_t *entry1 = of1;
const counts_entry_t *entry2 = of2;
......@@ -139,8 +136,7 @@ htab_counts_entry_eq (of1, of2)
}
static void
htab_counts_entry_del (of)
void *of;
htab_counts_entry_del (void *of)
{
counts_entry_t *entry = of;
......@@ -151,7 +147,7 @@ htab_counts_entry_del (of)
/* Read in the counts file, if available. */
static void
read_counts_file ()
read_counts_file (void)
{
gcov_unsigned_t fn_ident = 0;
gcov_unsigned_t version, checksum = -1;
......@@ -413,7 +409,7 @@ checksum_string (unsigned chksum, const char *string)
/* Compute checksum for the current function. We generate a CRC32. */
static unsigned
compute_checksum ()
compute_checksum (void)
{
unsigned chksum = DECL_SOURCE_LINE (current_function_decl);
......@@ -430,7 +426,7 @@ compute_checksum ()
should be output. */
int
coverage_begin_output ()
coverage_begin_output (void)
{
if (no_coverage)
return 0;
......@@ -472,7 +468,7 @@ coverage_begin_output ()
error has occurred. Save function coverage counts. */
void
coverage_end_function ()
coverage_end_function (void)
{
unsigned i;
......@@ -509,8 +505,7 @@ coverage_end_function ()
/* Creates the gcov_fn_info RECORD_TYPE. */
static tree
build_fn_info_type (counters)
unsigned counters;
build_fn_info_type (unsigned int counters)
{
tree type = (*lang_hooks.types.make_type) (RECORD_TYPE);
tree field, fields;
......@@ -542,9 +537,7 @@ build_fn_info_type (counters)
RECORD_TYPE. */
static tree
build_fn_info_value (function, type)
const struct function_list *function;
tree type;
build_fn_info_value (const struct function_list *function, tree type)
{
tree value = NULL_TREE;
tree fields = TYPE_FIELDS (type);
......@@ -586,7 +579,7 @@ build_fn_info_value (function, type)
/* Creates the gcov_ctr_info RECORD_TYPE. */
static tree
build_ctr_info_type ()
build_ctr_info_type (void)
{
tree type = (*lang_hooks.types.make_type) (RECORD_TYPE);
tree field, fields = NULL_TREE;
......@@ -623,9 +616,7 @@ build_ctr_info_type ()
RECORD_TYPE. */
static tree
build_ctr_info_value (counter, type)
unsigned counter;
tree type;
build_ctr_info_value (unsigned int counter, tree type)
{
tree value = NULL_TREE;
tree fields = TYPE_FIELDS (type);
......@@ -679,7 +670,7 @@ build_ctr_info_value (counter, type)
CONSTRUCTOR. */
static tree
build_gcov_info ()
build_gcov_info (void)
{
unsigned n_ctr_types, ix;
tree type, const_type;
......@@ -810,7 +801,7 @@ build_gcov_info ()
gcov-io.h. Write out the constructor to call __gcov_init. */
static void
create_coverage ()
create_coverage (void)
{
tree gcov_info, gcov_info_value;
char name[20];
......@@ -884,8 +875,7 @@ create_coverage ()
of graph file. */
void
coverage_init (filename)
const char *filename;
coverage_init (const char *filename)
{
int len = strlen (filename);
......@@ -906,7 +896,7 @@ coverage_init (filename)
variables and constructor. */
void
coverage_finish ()
coverage_finish (void)
{
create_coverage ();
if (bbg_file_opened)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment