gcc.c (add_prefix, [...]): Remove penultimate parameter.

2004-08-03  Paolo Bonzini <bonzini@gnu.org>

	* gcc.c (add_prefix, add_sysrooted_prefix): Remove
	penultimate parameter.  All callers adjusted.
	(struct prefix_list): Remove used_flag_ptr.
	(find_a_file): Do not set *pl->used_flag_ptr.
	(warn_B, warn_std_ptr): Remove.

From-SVN: r85469
This commit is contained in:
Paolo Bonzini 2004-08-03 09:38:08 +00:00 committed by Paolo Bonzini
parent d32ab9922e
commit 1a5d37a123
2 changed files with 51 additions and 81 deletions

View file

@ -1,3 +1,11 @@
2004-08-03 Paolo Bonzini <bonzini@gnu.org>
* gcc.c (add_prefix, add_sysrooted_prefix): Remove
penultimate parameter. All callers adjusted.
(struct prefix_list): Remove used_flag_ptr.
(find_a_file): Do not set *pl->used_flag_ptr.
(warn_B, warn_std_ptr): Remove.
2004-08-03 Yossi Markovich <yossim@il.ibm.com>
Mostafa Hagog <mustafa@il.ibm.com>

124
gcc/gcc.c
View file

@ -303,9 +303,9 @@ static void putenv_from_prefixes (struct path_prefix *, const char *);
static int access_check (const char *, int);
static char *find_a_file (struct path_prefix *, const char *, int, int);
static void add_prefix (struct path_prefix *, const char *, const char *,
int, int, int *, int);
int, int, int);
static void add_sysrooted_prefix (struct path_prefix *, const char *,
const char *, int, int, int *, int);
const char *, int, int, int);
static void translate_options (int *, const char *const **);
static char *skip_whitespace (char *);
static void delete_if_ordinary (const char *);
@ -1384,7 +1384,6 @@ struct prefix_list
struct prefix_list *next; /* Next in linked list. */
int require_machine_suffix; /* Don't use without machine_suffix. */
/* 2 means try both machine_suffix and just_machine_suffix. */
int *used_flag_ptr; /* 1 if a file was found with this prefix. */
int priority; /* Sort key - priority within list. */
int os_multilib; /* 1 if OS multilib scheme should be used,
0 for GCC multilib scheme. */
@ -2502,11 +2501,7 @@ find_a_file (struct path_prefix *pprefix, const char *name, int mode,
strcat (temp, multilib_name);
strcat (temp, file_suffix);
if (access_check (temp, mode) == 0)
{
if (pl->used_flag_ptr != 0)
*pl->used_flag_ptr = 1;
return temp;
}
return temp;
}
/* Now try just the multilib_name. */
@ -2514,11 +2509,7 @@ find_a_file (struct path_prefix *pprefix, const char *name, int mode,
strcat (temp, machine_suffix);
strcat (temp, multilib_name);
if (access_check (temp, mode) == 0)
{
if (pl->used_flag_ptr != 0)
*pl->used_flag_ptr = 1;
return temp;
}
return temp;
}
/* Certain prefixes are tried with just the machine type,
@ -2534,22 +2525,14 @@ find_a_file (struct path_prefix *pprefix, const char *name, int mode,
strcat (temp, multilib_name);
strcat (temp, file_suffix);
if (access_check (temp, mode) == 0)
{
if (pl->used_flag_ptr != 0)
*pl->used_flag_ptr = 1;
return temp;
}
return temp;
}
strcpy (temp, pl->prefix);
strcat (temp, just_machine_suffix);
strcat (temp, multilib_name);
if (access_check (temp, mode) == 0)
{
if (pl->used_flag_ptr != 0)
*pl->used_flag_ptr = 1;
return temp;
}
return temp;
}
/* Certain prefixes can't be used without the machine suffix
@ -2564,21 +2547,13 @@ find_a_file (struct path_prefix *pprefix, const char *name, int mode,
strcat (temp, this_name);
strcat (temp, file_suffix);
if (access_check (temp, mode) == 0)
{
if (pl->used_flag_ptr != 0)
*pl->used_flag_ptr = 1;
return temp;
}
return temp;
}
strcpy (temp, pl->prefix);
strcat (temp, this_name);
if (access_check (temp, mode) == 0)
{
if (pl->used_flag_ptr != 0)
*pl->used_flag_ptr = 1;
return temp;
}
return temp;
}
}
@ -2612,7 +2587,7 @@ enum path_prefix_priority
static void
add_prefix (struct path_prefix *pprefix, const char *prefix,
const char *component, /* enum prefix_priority */ int priority,
int require_machine_suffix, int *warn, int os_multilib)
int require_machine_suffix, int os_multilib)
{
struct prefix_list *pl, **prev;
int len;
@ -2632,11 +2607,8 @@ add_prefix (struct path_prefix *pprefix, const char *prefix,
pl = xmalloc (sizeof (struct prefix_list));
pl->prefix = prefix;
pl->require_machine_suffix = require_machine_suffix;
pl->used_flag_ptr = warn;
pl->priority = priority;
pl->os_multilib = os_multilib;
if (warn)
*warn = 0;
/* Insert after PREV. */
pl->next = (*prev);
@ -2648,7 +2620,7 @@ static void
add_sysrooted_prefix (struct path_prefix *pprefix, const char *prefix,
const char *component,
/* enum prefix_priority */ int priority,
int require_machine_suffix, int *warn, int os_multilib)
int require_machine_suffix, int os_multilib)
{
if (!IS_ABSOLUTE_PATH (prefix))
abort ();
@ -2665,7 +2637,7 @@ add_sysrooted_prefix (struct path_prefix *pprefix, const char *prefix,
}
add_prefix (pprefix, prefix, component, priority,
require_machine_suffix, warn, os_multilib);
require_machine_suffix, os_multilib);
}
/* Execute the command specified by the arguments on the current line of spec.
@ -2990,12 +2962,6 @@ static int added_libraries;
/* And a vector of corresponding output files is made up later. */
const char **outfiles;
/* Used to track if none of the -B paths are used. */
static int warn_B;
/* Gives value to pass as "warn" to add_prefix for standard prefixes. */
static int *warn_std_ptr = 0;
#if defined(HAVE_TARGET_OBJECT_SUFFIX) || defined(HAVE_TARGET_EXECUTABLE_SUFFIX)
@ -3290,9 +3256,9 @@ process_command (int argc, const char **argv)
set_std_prefix (gcc_exec_prefix, len);
add_prefix (&exec_prefixes, gcc_libexec_prefix, "GCC",
PREFIX_PRIORITY_LAST, 0, NULL, 0);
PREFIX_PRIORITY_LAST, 0, 0);
add_prefix (&startfile_prefixes, gcc_exec_prefix, "GCC",
PREFIX_PRIORITY_LAST, 0, NULL, 0);
PREFIX_PRIORITY_LAST, 0, 0);
}
/* COMPILER_PATH and LIBRARY_PATH have values
@ -3320,9 +3286,9 @@ process_command (int argc, const char **argv)
else
nstore[endp - startp] = 0;
add_prefix (&exec_prefixes, nstore, 0,
PREFIX_PRIORITY_LAST, 0, NULL, 0);
PREFIX_PRIORITY_LAST, 0, 0);
add_prefix (&include_prefixes, nstore, 0,
PREFIX_PRIORITY_LAST, 0, NULL, 0);
PREFIX_PRIORITY_LAST, 0, 0);
if (*endp == 0)
break;
endp = startp = endp + 1;
@ -3354,7 +3320,7 @@ process_command (int argc, const char **argv)
else
nstore[endp - startp] = 0;
add_prefix (&startfile_prefixes, nstore, NULL,
PREFIX_PRIORITY_LAST, 0, NULL, 1);
PREFIX_PRIORITY_LAST, 0, 1);
if (*endp == 0)
break;
endp = startp = endp + 1;
@ -3387,7 +3353,7 @@ process_command (int argc, const char **argv)
else
nstore[endp - startp] = 0;
add_prefix (&startfile_prefixes, nstore, NULL,
PREFIX_PRIORITY_LAST, 0, NULL, 1);
PREFIX_PRIORITY_LAST, 0, 1);
if (*endp == 0)
break;
endp = startp = endp + 1;
@ -3675,23 +3641,23 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
{
if (len == 7)
add_prefix (&include_prefixes, "./", NULL,
PREFIX_PRIORITY_B_OPT, 0, NULL, 0);
PREFIX_PRIORITY_B_OPT, 0, 0);
else
{
char *string = xmalloc (len - 6);
memcpy (string, value, len - 7);
string[len - 7] = 0;
add_prefix (&include_prefixes, string, NULL,
PREFIX_PRIORITY_B_OPT, 0, NULL, 0);
PREFIX_PRIORITY_B_OPT, 0, 0);
}
}
add_prefix (&exec_prefixes, value, NULL,
PREFIX_PRIORITY_B_OPT, 0, &warn_B, 0);
PREFIX_PRIORITY_B_OPT, 0, 0);
add_prefix (&startfile_prefixes, value, NULL,
PREFIX_PRIORITY_B_OPT, 0, &warn_B, 0);
PREFIX_PRIORITY_B_OPT, 0, 0);
add_prefix (&include_prefixes, value, NULL,
PREFIX_PRIORITY_B_OPT, 0, NULL, 0);
PREFIX_PRIORITY_B_OPT, 0, 0);
n_switches++;
}
break;
@ -3829,21 +3795,21 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
as well as trying the machine and the version. */
#ifndef OS2
add_prefix (&exec_prefixes, standard_libexec_prefix, "GCC",
PREFIX_PRIORITY_LAST, 1, warn_std_ptr, 0);
PREFIX_PRIORITY_LAST, 1, 0);
add_prefix (&exec_prefixes, standard_libexec_prefix, "BINUTILS",
PREFIX_PRIORITY_LAST, 2, warn_std_ptr, 0);
PREFIX_PRIORITY_LAST, 2, 0);
add_prefix (&exec_prefixes, standard_exec_prefix, "BINUTILS",
PREFIX_PRIORITY_LAST, 2, warn_std_ptr, 0);
PREFIX_PRIORITY_LAST, 2, 0);
add_prefix (&exec_prefixes, standard_exec_prefix_1, "BINUTILS",
PREFIX_PRIORITY_LAST, 2, warn_std_ptr, 0);
PREFIX_PRIORITY_LAST, 2, 0);
add_prefix (&exec_prefixes, standard_exec_prefix_2, "BINUTILS",
PREFIX_PRIORITY_LAST, 2, warn_std_ptr, 0);
PREFIX_PRIORITY_LAST, 2, 0);
#endif
add_prefix (&startfile_prefixes, standard_exec_prefix, "BINUTILS",
PREFIX_PRIORITY_LAST, 1, warn_std_ptr, 0);
PREFIX_PRIORITY_LAST, 1, 0);
add_prefix (&startfile_prefixes, standard_exec_prefix_2, "BINUTILS",
PREFIX_PRIORITY_LAST, 1, warn_std_ptr, 0);
PREFIX_PRIORITY_LAST, 1, 0);
tooldir_prefix = concat (tooldir_base_prefix, spec_machine,
dir_separator_str, NULL);
@ -3866,11 +3832,11 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
add_prefix (&exec_prefixes,
concat (gcc_exec_tooldir_prefix, "bin",
dir_separator_str, NULL),
NULL, PREFIX_PRIORITY_LAST, 0, NULL, 0);
NULL, PREFIX_PRIORITY_LAST, 0, 0);
add_prefix (&startfile_prefixes,
concat (gcc_exec_tooldir_prefix, "lib",
dir_separator_str, NULL),
NULL, PREFIX_PRIORITY_LAST, 0, NULL, 1);
NULL, PREFIX_PRIORITY_LAST, 0, 1);
}
tooldir_prefix = concat (standard_exec_prefix, spec_machine,
@ -3880,10 +3846,10 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
add_prefix (&exec_prefixes,
concat (tooldir_prefix, "bin", dir_separator_str, NULL),
"BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL, 0);
"BINUTILS", PREFIX_PRIORITY_LAST, 0, 0);
add_prefix (&startfile_prefixes,
concat (tooldir_prefix, "lib", dir_separator_str, NULL),
"BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL, 1);
"BINUTILS", PREFIX_PRIORITY_LAST, 0, 1);
#if defined(TARGET_SYSTEM_ROOT_RELOCATABLE) && !defined(VMS)
/* If the normal TARGET_SYSTEM_ROOT is inside of $exec_prefix,
@ -6165,7 +6131,7 @@ main (int argc, const char **argv)
if (*md_exec_prefix)
{
add_prefix (&exec_prefixes, md_exec_prefix, "GCC",
PREFIX_PRIORITY_LAST, 0, NULL, 0);
PREFIX_PRIORITY_LAST, 0, 0);
}
}
@ -6197,7 +6163,7 @@ main (int argc, const char **argv)
int ndx;
for (ndx = 0; ndx < argbuf_index; ndx++)
add_sysrooted_prefix (&startfile_prefixes, argbuf[ndx], "BINUTILS",
PREFIX_PRIORITY_LAST, 0, NULL, 1);
PREFIX_PRIORITY_LAST, 0, 1);
}
/* We should eventually get rid of all these and stick to
startfile_prefix_spec exclusively. */
@ -6205,15 +6171,15 @@ main (int argc, const char **argv)
{
if (*md_exec_prefix)
add_sysrooted_prefix (&startfile_prefixes, md_exec_prefix, "GCC",
PREFIX_PRIORITY_LAST, 0, NULL, 1);
PREFIX_PRIORITY_LAST, 0, 1);
if (*md_startfile_prefix)
add_sysrooted_prefix (&startfile_prefixes, md_startfile_prefix,
"GCC", PREFIX_PRIORITY_LAST, 0, NULL, 1);
"GCC", PREFIX_PRIORITY_LAST, 0, 1);
if (*md_startfile_prefix_1)
add_sysrooted_prefix (&startfile_prefixes, md_startfile_prefix_1,
"GCC", PREFIX_PRIORITY_LAST, 0, NULL, 1);
"GCC", PREFIX_PRIORITY_LAST, 0, 1);
/* If standard_startfile_prefix is relative, base it on
standard_exec_prefix. This lets us move the installed tree
@ -6225,33 +6191,29 @@ main (int argc, const char **argv)
if (IS_ABSOLUTE_PATH (standard_startfile_prefix))
add_sysrooted_prefix (&startfile_prefixes,
standard_startfile_prefix, "BINUTILS",
PREFIX_PRIORITY_LAST, 0, NULL, 1);
PREFIX_PRIORITY_LAST, 0, 1);
else if (*cross_compile == '0')
{
if (gcc_exec_prefix)
add_prefix (&startfile_prefixes,
concat (gcc_exec_prefix, machine_suffix,
standard_startfile_prefix, NULL),
NULL, PREFIX_PRIORITY_LAST, 0, NULL, 1);
NULL, PREFIX_PRIORITY_LAST, 0, 1);
add_prefix (&startfile_prefixes,
concat (standard_exec_prefix,
machine_suffix,
standard_startfile_prefix, NULL),
NULL, PREFIX_PRIORITY_LAST, 0, NULL, 1);
NULL, PREFIX_PRIORITY_LAST, 0, 1);
}
if (*standard_startfile_prefix_1)
add_sysrooted_prefix (&startfile_prefixes,
standard_startfile_prefix_1, "BINUTILS",
PREFIX_PRIORITY_LAST, 0, NULL, 1);
PREFIX_PRIORITY_LAST, 0, 1);
if (*standard_startfile_prefix_2)
add_sysrooted_prefix (&startfile_prefixes,
standard_startfile_prefix_2, "BINUTILS",
PREFIX_PRIORITY_LAST, 0, NULL, 1);
#if 0 /* Can cause surprises, and one can use -B./ instead. */
add_prefix (&startfile_prefixes, "./", NULL,
PREFIX_PRIORITY_LAST, 1, NULL, 0);
#endif
PREFIX_PRIORITY_LAST, 0, 1);
}
/* Process any user specified specs in the order given on the command