gcc.c (modify_target): New variable and struct.
* gcc.c (modify_target): New variable and struct. (process_command): Handle MODIFY_TARGET_NAME. * tm.texi (MODIFY_TARGET_NAME): Add documentation for new macro. * config/pa/pa.h (MODIFY_TARGET_NAME): New macro. From-SVN: r36555
This commit is contained in:
parent
5fa7c8cec4
commit
dc36ec2cad
@ -1,5 +1,10 @@
|
||||
Wed Sep 20 15:39:14 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
|
||||
|
||||
* gcc.c (modify_target): New variable and struct.
|
||||
(process_command): Handle MODIFY_TARGET_NAME.
|
||||
* tm.texi (MODIFY_TARGET_NAME): Add documentation for new macro.
|
||||
* config/pa/pa.h (MODIFY_TARGET_NAME): New macro.
|
||||
|
||||
* c-decl.c (finish_decl): Add else's to avoid referencing
|
||||
TYPE_DOMAIN of an ERROR_MARK.
|
||||
|
||||
|
@ -326,6 +326,15 @@ extern int target_flags;
|
||||
#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
|
||||
#endif
|
||||
|
||||
/* This macro defines command-line switches that modify the default
|
||||
target name.
|
||||
|
||||
The definition is be an initializer for an array of structures. Each
|
||||
array element has have three elements: the switch name, one of the
|
||||
enumeration codes ADD or DELETE to indicate whether the string should be
|
||||
inserted or deleted, and the string to be inserted or deleted. */
|
||||
#define MODIFY_TARGET_NAME {{"-32", DELETE, "64"}, {"-64", ADD, "64"}}
|
||||
|
||||
/* Make gcc agree with <machine/ansi.h> */
|
||||
|
||||
#define SIZE_TYPE "unsigned int"
|
||||
|
71
gcc/gcc.c
71
gcc/gcc.c
@ -164,6 +164,21 @@ static const char *cross_compile = "1";
|
||||
static const char *cross_compile = "0";
|
||||
#endif
|
||||
|
||||
#ifdef MODIFY_TARGET_NAME
|
||||
|
||||
/* Information on how to alter the target name based on a command-line
|
||||
switch. The only case we support now is simply appending or deleting a
|
||||
string to or from the end of the first part of the configuration name. */
|
||||
|
||||
struct modify_target
|
||||
{
|
||||
const char *sw;
|
||||
enum add_del {ADD, DELETE} add_del;
|
||||
const char *str;
|
||||
}
|
||||
modify_target[] = MODIFY_TARGET_NAME;
|
||||
#endif
|
||||
|
||||
/* The number of errors that have occurred; the link phase will not be
|
||||
run if this is non-zero. */
|
||||
static int error_count = 0;
|
||||
@ -2832,6 +2847,7 @@ process_command (argc, argv)
|
||||
const char *const *argv;
|
||||
{
|
||||
register int i;
|
||||
unsigned int j;
|
||||
const char *temp;
|
||||
char *temp1;
|
||||
const char *spec_lang = 0;
|
||||
@ -2839,6 +2855,9 @@ process_command (argc, argv)
|
||||
int have_c = 0;
|
||||
int have_o = 0;
|
||||
int lang_n_infiles = 0;
|
||||
#ifdef MODIFY_TARGET_NAME
|
||||
int is_modify_target_name;
|
||||
#endif
|
||||
|
||||
GET_ENV_PATH_LIST (gcc_exec_prefix, "GCC_EXEC_PREFIX");
|
||||
|
||||
@ -3005,6 +3024,7 @@ process_command (argc, argv)
|
||||
|
||||
/* Scan argv twice. Here, the first time, just count how many switches
|
||||
there will be in their vector, and how many input files in theirs.
|
||||
Also parse any switches that determine the configuration name, such as -b.
|
||||
Here we also parse the switches that cc itself uses (e.g. -v). */
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
@ -3316,6 +3336,46 @@ process_command (argc, argv)
|
||||
|
||||
default:
|
||||
normal_switch:
|
||||
|
||||
#ifdef MODIFY_TARGET_NAME
|
||||
is_modify_target_name = 0;
|
||||
|
||||
for (j = 0;
|
||||
j < sizeof modify_target / sizeof modify_target[0]; j++)
|
||||
if (! strcmp (argv[i], modify_target[j].sw))
|
||||
{
|
||||
char *new_name
|
||||
= (char *) xmalloc (strlen (modify_target[j].str)
|
||||
+ strlen (spec_machine));
|
||||
const char *p, *r;
|
||||
char *q;
|
||||
int made_addition = 0;
|
||||
|
||||
is_modify_target_name = 1;
|
||||
for (p = spec_machine, q = new_name; *p != 0; )
|
||||
{
|
||||
if (modify_target[j].add_del == DELETE
|
||||
&& (! strncmp (q, modify_target[j].str,
|
||||
strlen (modify_target[j].str))))
|
||||
p += strlen (modify_target[j].str);
|
||||
else if (modify_target[j].add_del == ADD
|
||||
&& ! made_addition && *p == '-')
|
||||
{
|
||||
for (r = modify_target[j].str; *r != 0; )
|
||||
*q++ = *r++;
|
||||
made_addition = 1;
|
||||
}
|
||||
|
||||
*q++ = *p++;
|
||||
}
|
||||
|
||||
spec_machine = new_name;
|
||||
}
|
||||
|
||||
if (is_modify_target_name)
|
||||
break;
|
||||
#endif
|
||||
|
||||
n_switches++;
|
||||
|
||||
if (SWITCH_TAKES_ARG (c) > (p[1] != 0))
|
||||
@ -3413,6 +3473,17 @@ process_command (argc, argv)
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
/* Just skip the switches that were handled by the preceding loop. */
|
||||
#ifdef MODIFY_TARGET_NAME
|
||||
is_modify_target_name = 0;
|
||||
|
||||
for (j = 0; j < sizeof modify_target / sizeof modify_target[0]; j++)
|
||||
if (! strcmp (argv[i], modify_target[j].sw))
|
||||
is_modify_target_name = 1;
|
||||
|
||||
if (is_modify_target_name)
|
||||
;
|
||||
else
|
||||
#endif
|
||||
if (! strncmp (argv[i], "-Wa,", 4))
|
||||
;
|
||||
else if (! strncmp (argv[i], "-Wp,", 4))
|
||||
|
26
gcc/tm.texi
26
gcc/tm.texi
@ -387,6 +387,32 @@ comes before @code{SYSTEM_INCLUDE_DIR} in the search order.
|
||||
Cross compilers do not use this macro and do not search either
|
||||
@file{/usr/local/include} or its replacement.
|
||||
|
||||
@findex MODIFY_TARGET_NAME
|
||||
@item MODIFY_TARGET_NAME
|
||||
Define this macro if you with to define command-line switches that modify the
|
||||
default target name
|
||||
|
||||
For each switch, you can include a string to be appended to the first
|
||||
part of the configuration name or a string to be deleted from the
|
||||
configuration name, if present. The definition should be an initializer
|
||||
for an array of structures. Each array element should have three
|
||||
elements: the switch name (a string constant, including the initial
|
||||
dash), one of the enumeration codes @code{ADD} or @code{DELETE} to
|
||||
indicate whether the string should be inserted or deleted, and the string
|
||||
to be inserted or deleted (a string constant).
|
||||
|
||||
For example, on a machine where @samp{64} at the end of the
|
||||
configuration name denotes a 64-bit target and you want the @samp{-32}
|
||||
and @samp{-64} switches to select between 32- and 64-bit targets, you would
|
||||
code
|
||||
|
||||
@smallexample
|
||||
#define MODIFY_TARGET_NAME \
|
||||
@{ @{ "-32", DELETE, "64"@}, \
|
||||
@{"-64", ADD, "64"@}@}
|
||||
@end smallexample
|
||||
|
||||
|
||||
@findex SYSTEM_INCLUDE_DIR
|
||||
@item SYSTEM_INCLUDE_DIR
|
||||
Define this macro as a C string constant if you wish to specify a
|
||||
|
Loading…
Reference in New Issue
Block a user