+2008-01-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR driver/34904
+ * gcc.c (SWITCH_OK): Removed.
+ (SWITCH_LIVE): Changed to bit.
+ (SWITCH_FALSE): Likewise.
+ (SWITCH_IGNORE): Likewise.
+ (switchstr): Change live_cond to unsigned int.
+ (process_command): Replace SWITCH_OK with 0.
+ (do_self_spec): Likewise.
+ (set_collect_gcc_options): Check the SWITCH_IGNORE bit.
+ (give_switch): Likewise.
+ (used_arg): Likewise.
+ (do_spec_1): Set the SWITCH_IGNORE bit.
+ (check_live_switch): Check both SWITCH_LIVE and SWITCH_FALSE
+ bits. Set the SWITCH_LIVE bit.
+
2008-01-24 Andreas Krebbel <krebbel1@de.ibm.com>
* config/s390/s390.h (MOVE_RATIO): Define new target macro.
If a switch uses following arguments, then the `part1' field
is the switch itself and the `args' field
is a null-terminated vector containing the following arguments.
- The `live_cond' field is:
- 0 when initialized
- 1 if the switch is true in a conditional spec,
- -1 if false (overridden by a later switch)
- -2 if this switch should be ignored (used in %<S)
+ Bits in the `live_cond' field are:
+ SWITCH_LIVE to indicate this switch is true in a conditional spec.
+ SWITCH_FALSE to indicate this switch is overridden by a later switch.
+ SWITCH_IGNORE to indicate this switch should be ignored (used in %<S).
The `validated' field is nonzero if any spec has looked at this switch;
if it remains zero at the end of the run, it must be meaningless. */
-#define SWITCH_OK 0
-#define SWITCH_FALSE -1
-#define SWITCH_IGNORE -2
-#define SWITCH_LIVE 1
+#define SWITCH_LIVE 0x1
+#define SWITCH_FALSE 0x2
+#define SWITCH_IGNORE 0x4
struct switchstr
{
const char *part1;
const char **args;
- int live_cond;
+ unsigned int live_cond;
unsigned char validated;
unsigned char ordering;
};
-e0 or -e1 down into the linker. */
switches[n_switches].part1 = &argv[i][0];
switches[n_switches].args = 0;
- switches[n_switches].live_cond = SWITCH_OK;
+ switches[n_switches].live_cond = 0;
switches[n_switches].validated = 0;
n_switches++;
}
else
switches[n_switches].args = 0;
- switches[n_switches].live_cond = SWITCH_OK;
+ switches[n_switches].live_cond = 0;
switches[n_switches].validated = 0;
switches[n_switches].ordering = 0;
/* These are always valid, since gcc.c itself understands the
first_time = FALSE;
/* Ignore elided switches. */
- if (switches[i].live_cond == SWITCH_IGNORE)
+ if ((switches[i].live_cond & SWITCH_IGNORE) != 0)
continue;
obstack_grow (&collect_obstack, "'-", 2);
sw = &switches[i + first];
sw->part1 = &argbuf[i][1];
sw->args = 0;
- sw->live_cond = SWITCH_OK;
+ sw->live_cond = 0;
sw->validated = 0;
sw->ordering = 0;
}
if (!strncmp (switches[i].part1, p, len - have_wildcard)
&& (have_wildcard || switches[i].part1[len] == '\0'))
{
- switches[i].live_cond = SWITCH_IGNORE;
+ switches[i].live_cond |= SWITCH_IGNORE;
switches[i].validated = 1;
}
/* If we already processed this switch and determined if it was
live or not, return our past determination. */
if (switches[switchnum].live_cond != 0)
- return switches[switchnum].live_cond > 0;
+ return ((switches[switchnum].live_cond & SWITCH_LIVE) != 0
+ && (switches[switchnum].live_cond & SWITCH_FALSE) == 0);
/* Now search for duplicate in a manner that depends on the name. */
switch (*name)
}
/* Otherwise the switch is live. */
- switches[switchnum].live_cond = SWITCH_LIVE;
+ switches[switchnum].live_cond |= SWITCH_LIVE;
return 1;
}
\f
static void
give_switch (int switchnum, int omit_first_word)
{
- if (switches[switchnum].live_cond == SWITCH_IGNORE)
+ if ((switches[switchnum].live_cond & SWITCH_IGNORE) != 0)
return;
if (!omit_first_word)
mswitches
= XNEWVEC (struct mswitchstr, n_mdswitches + (n_switches ? n_switches : 1));
for (i = 0; i < n_switches; i++)
- if (switches[i].live_cond != SWITCH_IGNORE)
+ if ((switches[i].live_cond & SWITCH_IGNORE) == 0)
{
int xlen = strlen (switches[i].part1);
for (j = 0; j < cnt; j++)