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
This commit is contained in:
Andreas Jaeger 2003-06-29 14:07:06 +02:00 committed by Andreas Jaeger
parent 4e3f84b7ca
commit 159b3be1f3
7 changed files with 281 additions and 399 deletions

View File

@ -1,3 +1,12 @@
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

View File

@ -104,7 +104,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
/* Some systems have an ISCOFF macro, but others do not. In some cases
the macro may be wrong. MY_ISCOFF is defined in tm.h files for machines
that either do not have an ISCOFF macro in /usr/include or for those
that either do not have an ISCOFF macro in /usr/include or for those
where it is wrong. */
#ifndef MY_ISCOFF
@ -175,7 +175,7 @@ int no_demangle;
/* Linked lists of constructor and destructor names. */
struct id
struct id
{
struct id *next;
int sequence;
@ -264,58 +264,55 @@ 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;
int fd;
if (oldfd == newfd)
return oldfd;
close (newfd);
@ -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);
@ -363,7 +359,7 @@ void
notice (const char *msgid, ...)
{
va_list ap;
va_start (ap, msgid);
vfprintf (stderr, _(msgid), ap);
va_end (ap);
@ -376,7 +372,7 @@ fatal_perror (const char * msgid, ...)
{
int e = errno;
va_list ap;
va_start (ap, msgid);
fprintf (stderr, "collect2: ");
vfprintf (stderr, _(msgid), ap);
@ -392,7 +388,7 @@ void
fatal (const char * msgid, ...)
{
va_list ap;
va_start (ap, msgid);
fprintf (stderr, "collect2: ");
vfprintf (stderr, _(msgid), ap);
@ -408,7 +404,7 @@ void
error (const char * msgid, ...)
{
va_list ap;
va_start (ap, msgid);
fprintf (stderr, "collect2: ");
vfprintf (stderr, _(msgid), ap);
@ -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; };
@ -611,14 +602,12 @@ static const char *const target_machine = TARGET_MACHINE;
#endif
/* Search for NAME using prefix list PPREFIX. We only look for executable
files.
files.
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;
@ -626,7 +615,7 @@ find_a_file (pprefix, name)
if (debug)
fprintf (stderr, "Looking for '%s'\n", name);
#ifdef HOST_EXECUTABLE_SUFFIX
len += strlen (HOST_EXECUTABLE_SUFFIX);
#endif
@ -647,7 +636,7 @@ find_a_file (pprefix, name)
if (debug)
fprintf (stderr, " - found: absolute path\n");
return temp;
}
@ -656,7 +645,7 @@ find_a_file (pprefix, name)
So try appending that. */
strcpy (temp, name);
strcat (temp, HOST_EXECUTABLE_SUFFIX);
if (access (temp, X_OK) == 0)
return temp;
#endif
@ -671,7 +660,7 @@ find_a_file (pprefix, name)
strcpy (temp, pl->prefix);
strcat (temp, name);
if (stat (temp, &st) >= 0
&& ! S_ISDIR (st.st_mode)
&& access (temp, X_OK) == 0)
@ -681,7 +670,7 @@ find_a_file (pprefix, name)
/* Some systems have a suffix for executable files.
So try appending that. */
strcat (temp, HOST_EXECUTABLE_SUFFIX);
if (stat (temp, &st) >= 0
&& ! S_ISDIR (st.st_mode)
&& access (temp, X_OK) == 0)
@ -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,16 +732,14 @@ 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);
if (debug)
fprintf (stderr, "Convert string '%s' into prefixes, separator = '%c'\n", p, PATH_SEPARATOR);
startp = endp = p;
while (1)
{
@ -777,7 +760,7 @@ prefix_from_string (p, pprefix)
if (debug)
fprintf (stderr, " - add prefix: %s\n", nstore);
add_prefix (pprefix, nstore);
if (*endp == 0)
break;
@ -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";
@ -890,7 +870,7 @@ main (argc, argv)
are called. */
{
int i;
for (i = 1; argv[i] != NULL; i ++)
if (! strcmp (argv[i], "-debug"))
debug = 1;
@ -1053,7 +1033,7 @@ main (argc, argv)
add_prefix (&libpath_lib_dirs, "/usr/lib");
#endif
/* Get any options that the upper GCC wants to pass to the sub-GCC.
/* Get any options that the upper GCC wants to pass to the sub-GCC.
AIX support needs to know if -shared has been specified before
parsing commandline arguments. */
@ -1143,10 +1123,10 @@ main (argc, argv)
#ifdef COLLECT_EXPORT_LIST
/* Saving directories where to search for libraries. */
case 'L':
case 'L':
add_prefix (&cmdline_lib_dirs, arg+2);
break;
#else
#else
#if LINK_ELIMINATE_DUPLICATE_LDIRECTORIES
case 'L':
if (is_in_args (arg, (const char **) ld1_argv, ld1-1))
@ -1211,8 +1191,8 @@ main (argc, argv)
*object++ = arg;
#ifdef COLLECT_EXPORT_LIST
/* libraries can be specified directly, i.e. without -l flag. */
else
{
else
{
/* Saving a full library name. */
add_to_list (&libs, arg);
}
@ -1246,7 +1226,7 @@ main (argc, argv)
if (exports.first)
{
char *buf = concat ("-bE:", export_file, NULL);
*ld1++ = buf;
*ld2++ = buf;
@ -1378,7 +1358,7 @@ main (argc, argv)
{
char **real_strip_argv = (char **) xcalloc (sizeof (char *), 3);
const char ** strip_argv = (const char **) real_strip_argv;
strip_argv[0] = strip_file_name;
strip_argv[1] = output_file;
strip_argv[2] = (char *) 0;
@ -1470,7 +1450,7 @@ main (argc, argv)
/* Let scan_prog_file do any final mods (OSF/rose needs this for
constructors/destructors in shared libraries. */
scan_prog_file (output_file, PASS_SECOND);
#endif
#endif
maybe_unlink (c_file);
maybe_unlink (o_file);
@ -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,16 +1897,14 @@ 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 */
int frames = (frame_tables.number > 0);
fprintf (stream, "typedef void entry_pt();\n\n");
write_list_with_asm (stream, "extern entry_pt ", constructors.first);
if (frames)
@ -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)
@ -2149,7 +2091,7 @@ scan_prog_file (prog_name, which_pass)
if (ch != '_')
continue;
name = p;
/* Find the end of the symbol name.
Do not include `|', because Encore nm can tack that on the end. */
@ -2229,8 +2171,8 @@ scan_prog_file (prog_name, which_pass)
#include <sys/dir.h>
/* pointers to the object file */
unsigned object; /* address of memory mapped file */
unsigned objsize; /* size of memory mapped to file */
unsigned object; /* address of memory mapped file */
unsigned objsize; /* size of memory mapped to file */
char * code; /* pointer to code segment */
char * data; /* pointer to data segment */
struct nlist *symtab; /* pointer to symbol table */
@ -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;
@ -2344,7 +2276,7 @@ locatelib (name)
char *ld_rules;
char *ldr = 0;
/* counting elements in array, need 1 extra for null */
cnt = 1;
cnt = 1;
ld_rules = (char *) (ld_2->ld_rules + code);
if (ld_rules)
{
@ -2370,7 +2302,7 @@ locatelib (name)
if (ldr)
{
*pp++ = ldr;
for (; *ldr != 0; ldr++)
for (; *ldr != 0; ldr++)
if (*ldr == ':')
{
*ldr++ = 0;
@ -2380,7 +2312,7 @@ locatelib (name)
if (q)
{
*pp++ = q;
for (; *q != 0; q++)
for (; *q != 0; q++)
if (*q == ':')
{
*q++ = 0;
@ -2419,9 +2351,8 @@ locatelib (name)
/* Scan the _DYNAMIC structure of the output file to find shared libraries
that it depends upon and any constructors or destructors they contain. */
static void
scan_libraries (prog_name)
const char *prog_name;
static void
scan_libraries (const char *prog_name)
{
struct exec *header;
char *base;
@ -2494,14 +2425,13 @@ scan_libraries (prog_name)
the output file depends upon and their initialization/finalization
routines, if any. */
static void
scan_libraries (prog_name)
const char *prog_name;
static void
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)
@ -2591,7 +2521,7 @@ scan_libraries (prog_name)
fatal ("dynamic dependency %s not found", buf);
/* Find the end of the symbol name. */
for (end = p;
for (end = p;
(ch2 = *end) != '\0' && ch2 != '\n' && !ISSPACE (ch2) && ch2 != '|';
end++)
continue;
@ -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;
@ -2834,7 +2761,7 @@ scan_prog_file (prog_name, which_pass)
#ifdef COLLECT_EXPORT_LIST
/* If we are building a shared object on AIX we need
to explicitly export all global symbols. */
if (shared_obj)
if (shared_obj)
{
if (which_pass == PASS_OBJ && (! export_flag))
add_to_list (&exports, name);
@ -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;
@ -2912,7 +2838,7 @@ resolve_lib_name (name)
p = "/";
for (j = 0; libexts[j]; j++)
{
sprintf (lib_buf, "%s%slib%s.%s",
sprintf (lib_buf, "%s%slib%s.%s",
list->prefix, p, name, libexts[j]);
if (debug) fprintf (stderr, "searching for: %s\n", lib_buf);
if (file_exists (lib_buf))
@ -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)

View File

@ -1,5 +1,5 @@
/* Header file for collect/tlink routines.
Copyright (C) 1998 Free Software Foundation, Inc.
/* Header file for collect/tlink routines.
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 */

View File

@ -1,5 +1,5 @@
/* 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;

View File

@ -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);
@ -194,9 +191,9 @@ convert_to_real (type, expr)
if (fn)
{
tree arg0 = strip_float_extensions (TREE_VALUE (TREE_OPERAND (expr,
1)));
1)));
tree arglist = build_tree_list (NULL_TREE,
fold (convert_to_real (type, arg0)));
fold (convert_to_real (type, arg0)));
return build_function_call_expr (fn, arglist);
}
@ -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);
@ -483,7 +479,7 @@ convert_to_integer (type, expr)
/* Don't do unsigned arithmetic where signed was wanted,
or vice versa.
Exception: if both of the original operands were
unsigned then we can safely do the work as unsigned.
unsigned then we can safely do the work as unsigned.
Exception: shift operations take their type solely
from the first argument.
Exception: the LSHIFT_EXPR case above requires that
@ -558,7 +554,7 @@ convert_to_integer (type, expr)
/* It is sometimes worthwhile to push the narrowing down through
the conditional and never loses. */
return fold (build (COND_EXPR, type, TREE_OPERAND (expr, 0),
convert (type, TREE_OPERAND (expr, 1)),
convert (type, TREE_OPERAND (expr, 1)),
convert (type, TREE_OPERAND (expr, 2))));
default:
@ -593,11 +589,10 @@ 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);
switch (TREE_CODE (TREE_TYPE (expr)))
{
case REAL_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)))
{

View File

@ -1,5 +1,5 @@
/* 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);

View File

@ -49,8 +49,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
struct function_list
{
struct function_list *next; /* next function */
unsigned ident; /* function ident */
struct function_list *next; /* next function */
unsigned ident; /* function ident */
unsigned checksum; /* function checksum */
unsigned n_ctrs[GCOV_COUNTERS];/* number of counters. */
};
@ -61,7 +61,7 @@ typedef struct counts_entry
/* We hash by */
unsigned ident;
unsigned ctr;
/* Store */
unsigned checksum;
gcov_type *counts;
@ -69,7 +69,7 @@ typedef struct counts_entry
/* Workspace */
struct counts_entry *chain;
} counts_entry_t;
static struct function_list *functions_head = 0;
@ -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;
@ -163,7 +159,7 @@ read_counts_file ()
if (!gcov_open (da_file_name, 1))
return;
if (gcov_read_unsigned () != GCOV_DATA_MAGIC)
{
warning ("`%s' is not a gcov data file", da_file_name);
@ -174,7 +170,7 @@ read_counts_file ()
{
char v[4], e[4];
gcov_unsigned_t required = GCOV_VERSION;
for (ix = 4; ix--; required >>= 8, version >>= 8)
{
v[ix] = version;
@ -185,7 +181,7 @@ read_counts_file ()
gcov_close ();
return;
}
counts_hash = htab_create (10,
htab_counts_entry_hash, htab_counts_entry_eq,
htab_counts_entry_del);
@ -193,7 +189,7 @@ read_counts_file ()
{
gcov_unsigned_t length;
gcov_position_t offset;
length = gcov_read_unsigned ();
offset = gcov_position ();
if (tag == GCOV_TAG_FUNCTION)
@ -206,7 +202,7 @@ read_counts_file ()
new function begins a new set of program runs. We
must unlink the summaried chain. */
counts_entry_t *entry, *chain;
for (entry = summaried; entry; entry = chain)
{
chain = entry->chain;
@ -220,13 +216,13 @@ read_counts_file ()
{
counts_entry_t *entry;
struct gcov_summary summary;
gcov_read_summary (&summary);
seen_summary = 1;
for (entry = summaried; entry; entry = entry->chain)
{
struct gcov_ctr_summary *csum = &summary.ctrs[entry->ctr];
entry->summary.runs += csum->runs;
entry->summary.sum_all += csum->sum_all;
if (entry->summary.run_max < csum->run_max)
@ -271,8 +267,8 @@ read_counts_file ()
if (elt.ctr < GCOV_COUNTERS_SUMMABLE
/* This should always be true for a just allocated entry,
and always false for an existing one. Check this way, in
case the gcov file is corrupt. */
and always false for an existing one. Check this way, in
case the gcov file is corrupt. */
&& (!entry->chain || summaried != entry))
{
entry->chain = summaried;
@ -293,7 +289,7 @@ read_counts_file ()
da_file_name);
htab_delete (counts_hash);
}
gcov_close ();
}
@ -325,7 +321,7 @@ get_coverage_counts (unsigned counter, unsigned expected,
(DECL_ASSEMBLER_NAME (current_function_decl)));
return 0;
}
if (expected != entry->summary.num
|| compute_checksum () != entry->checksum)
{
@ -333,7 +329,7 @@ get_coverage_counts (unsigned counter, unsigned expected,
(DECL_ASSEMBLER_NAME (current_function_decl)));
return NULL;
}
if (summary)
*summary = &entry->summary;
@ -348,15 +344,15 @@ coverage_counter_alloc (unsigned counter, unsigned num)
{
if (no_coverage)
return 0;
if (!num)
return 1;
if (!ctr_labels[counter])
{
/* Generate and save a copy of this so it can be shared. */
char buf[20];
ASM_GENERATE_INTERNAL_LABEL (buf, "LPBX", counter + 1);
ctr_labels[counter] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf));
}
@ -399,21 +395,21 @@ checksum_string (unsigned chksum, const char *string)
for (ix = 8; ix--; value <<= 1)
{
unsigned feedback;
feedback = (value ^ chksum) & 0x80000000 ? 0x04c11db7 : 0;
chksum <<= 1;
chksum ^= feedback;
}
}
while (*string++);
return chksum;
}
/* 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,17 +426,17 @@ compute_checksum ()
should be output. */
int
coverage_begin_output ()
coverage_begin_output (void)
{
if (no_coverage)
return 0;
if (!bbg_function_announced)
{
const char *file = DECL_SOURCE_FILE (current_function_decl);
unsigned line = DECL_SOURCE_LINE (current_function_decl);
unsigned long offset;
if (!bbg_file_opened)
{
if (!gcov_open (bbg_file_name, -1))
@ -452,7 +448,7 @@ coverage_begin_output ()
}
bbg_file_opened = 1;
}
/* Announce function */
offset = gcov_write_tag (GCOV_TAG_FUNCTION);
gcov_write_unsigned (current_function_funcdef_no + 1);
@ -472,12 +468,12 @@ coverage_begin_output ()
error has occurred. Save function coverage counts. */
void
coverage_end_function ()
coverage_end_function (void)
{
unsigned i;
if (bbg_file_opened > 1 && gcov_is_error ())
{
{
warning ("error writing `%s'", bbg_file_name);
bbg_file_opened = -1;
}
@ -485,12 +481,12 @@ coverage_end_function ()
if (fn_ctr_mask)
{
struct function_list *item;
item = xmalloc (sizeof (struct function_list));
*functions_tail = item;
functions_tail = &item->next;
item->next = 0;
item->ident = current_function_funcdef_no + 1;
item->checksum = compute_checksum ();
@ -509,13 +505,12 @@ 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;
tree array_type;
/* ident */
fields = build_decl (FIELD_DECL, NULL_TREE, unsigned_intSI_type_node);
@ -526,7 +521,7 @@ build_fn_info_type (counters)
array_type = build_index_type (build_int_2 (counters - 1, 0));
array_type = build_array_type (unsigned_type_node, array_type);
/* counters */
field = build_decl (FIELD_DECL, NULL_TREE, array_type);
TREE_CHAIN (field) = fields;
@ -542,51 +537,49 @@ 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);
unsigned ix;
tree array_value = NULL_TREE;
/* ident */
value = tree_cons (fields,
convert (unsigned_intSI_type_node,
build_int_2 (function->ident, 0)),
value);
fields = TREE_CHAIN (fields);
/* checksum */
value = tree_cons (fields,
convert (unsigned_intSI_type_node,
build_int_2 (function->checksum, 0)),
value);
fields = TREE_CHAIN (fields);
/* counters */
for (ix = 0; ix != GCOV_COUNTERS; ix++)
if (prg_ctr_mask & (1 << ix))
{
tree counters = convert (unsigned_type_node,
build_int_2 (function->n_ctrs[ix], 0));
array_value = tree_cons (NULL_TREE, counters, array_value);
}
array_value = build_constructor (TREE_TYPE (fields), nreverse (array_value));
value = tree_cons (fields, array_value, value);
value = build_constructor (type, nreverse (value));
return value;
}
/* 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);
@ -641,16 +632,16 @@ build_ctr_info_value (counter, type)
if (prg_n_ctrs[counter])
{
tree array_type, array;
array_type = build_index_type (build_int_2 (prg_n_ctrs[counter] - 1, 0));
array_type = build_array_type (TREE_TYPE (TREE_TYPE (fields)),
array_type);
array = build (VAR_DECL, array_type, NULL_TREE, NULL_TREE);
TREE_STATIC (array) = 1;
DECL_NAME (array) = get_identifier (XSTR (ctr_labels[counter], 0));
assemble_variable (array, 0, 0, 0);
value = tree_cons (fields,
build1 (ADDR_EXPR, TREE_TYPE (fields), array),
value);
@ -671,7 +662,7 @@ build_ctr_info_value (counter, type)
value);
value = build_constructor (type, nreverse (value));
return value;
}
@ -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;
@ -694,15 +685,15 @@ build_gcov_info ()
unsigned n_fns;
const struct function_list *fn;
tree string_type;
/* Count the number of active counters. */
for (n_ctr_types = 0, ix = 0; ix != GCOV_COUNTERS; ix++)
if (prg_ctr_mask & (1 << ix))
n_ctr_types++;
type = (*lang_hooks.types.make_type) (RECORD_TYPE);
const_type = build_qualified_type (type, TYPE_QUAL_CONST);
/* Version ident */
field = build_decl (FIELD_DECL, NULL_TREE, unsigned_intSI_type_node);
TREE_CHAIN (field) = fields;
@ -710,13 +701,13 @@ build_gcov_info ()
value = tree_cons (field, convert (unsigned_intSI_type_node,
build_int_2 (GCOV_VERSION, 0)),
value);
/* next -- NULL */
field = build_decl (FIELD_DECL, NULL_TREE, build_pointer_type (const_type));
TREE_CHAIN (field) = fields;
fields = field;
value = tree_cons (field, null_pointer_node, value);
/* Filename */
string_type = build_pointer_type (build_qualified_type (char_type_node,
TYPE_QUAL_CONST));
@ -736,7 +727,7 @@ build_gcov_info ()
build_index_type (build_int_2 (filename_len, 0)));
value = tree_cons (field, build1 (ADDR_EXPR, string_type, filename_string),
value);
/* Build the fn_info type and initializer. */
fn_info_type = build_fn_info_type (n_ctr_types);
fn_info_ptr_type = build_pointer_type (build_qualified_type
@ -751,13 +742,13 @@ build_gcov_info ()
array_type = build_index_type (build_int_2 (n_fns - 1, 0));
array_type = build_array_type (fn_info_type, array_type);
fn_info_value = build_constructor (array_type, nreverse (fn_info_value));
fn_info_value = build1 (ADDR_EXPR, fn_info_ptr_type, fn_info_value);
}
else
fn_info_value = null_pointer_node;
/* number of functions */
field = build_decl (FIELD_DECL, NULL_TREE, unsigned_type_node);
TREE_CHAIN (field) = fields;
@ -765,7 +756,7 @@ build_gcov_info ()
value = tree_cons (field,
convert (unsigned_type_node, build_int_2 (n_fns, 0)),
value);
/* fn_info table */
field = build_decl (FIELD_DECL, NULL_TREE, fn_info_ptr_type);
TREE_CHAIN (field) = fields;
@ -780,7 +771,7 @@ build_gcov_info ()
convert (unsigned_type_node,
build_int_2 (prg_ctr_mask, 0)),
value);
/* counters */
ctr_info_type = build_ctr_info_type ();
ctr_info_ary_type = build_index_type (build_int_2 (n_ctr_types, 0));
@ -797,11 +788,11 @@ build_gcov_info ()
TREE_CHAIN (field) = fields;
fields = field;
value = tree_cons (field, ctr_info_value, value);
finish_builtin_struct (type, "__gcov_info", fields, NULL_TREE);
value = build_constructor (type, nreverse (value));
return value;
}
@ -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];
@ -819,10 +810,10 @@ create_coverage ()
rtx gcov_info_address;
no_coverage = 1; /* Disable any further coverage. */
if (!prg_ctr_mask)
return;
gcov_info_value = build_gcov_info ();
gcov_info = build (VAR_DECL, TREE_TYPE (gcov_info_value),
@ -832,7 +823,7 @@ create_coverage ()
TREE_STATIC (gcov_info) = 1;
ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 0);
DECL_NAME (gcov_info) = get_identifier (name);
/* Build structure. */
assemble_variable (gcov_info, 0, 0, 0);
@ -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);
@ -893,7 +883,7 @@ coverage_init (filename)
da_file_name = (char *) xmalloc (len + strlen (GCOV_DATA_SUFFIX) + 1);
strcpy (da_file_name, filename);
strcat (da_file_name, GCOV_DATA_SUFFIX);
/* Name of bbg file. */
bbg_file_name = (char *) xmalloc (len + strlen (GCOV_GRAPH_SUFFIX) + 1);
strcpy (bbg_file_name, filename);
@ -906,13 +896,13 @@ coverage_init (filename)
variables and constructor. */
void
coverage_finish ()
coverage_finish (void)
{
create_coverage ();
if (bbg_file_opened)
{
int error = gcov_close ();
if (error)
unlink (bbg_file_name);
#if SELF_COVERAGE