aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2008-01-24 18:57:12 +0000
committerH.J. Lu <hongjiu.lu@intel.com>2008-01-24 18:57:12 +0000
commitec00c887d59333fd0993c5de0aed3bd23b5a1879 (patch)
treee9e6b63ea7435d64c930fd27c960088d6f9c9ad5
parent23367a8f97ee7bee7c0f0e9244ec2f9ea6c97954 (diff)
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. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@131802 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog17
-rw-r--r--gcc/gcc.c37
2 files changed, 35 insertions, 19 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4047d861216..40a5823dd7d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,20 @@
+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.
diff --git a/gcc/gcc.c b/gcc/gcc.c
index b03e510bf5b..b63c0da1d1a 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -3082,24 +3082,22 @@ See %s for instructions.",
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;
};
@@ -4119,7 +4117,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
-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++;
}
@@ -4230,7 +4228,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
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
@@ -4311,7 +4309,7 @@ set_collect_gcc_options (void)
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);
@@ -4539,7 +4537,7 @@ do_self_spec (const char *spec)
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;
}
@@ -5289,7 +5287,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
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;
}
@@ -5907,7 +5905,8 @@ check_live_switch (int switchnum, int prefix_length)
/* 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)
@@ -5954,7 +5953,7 @@ check_live_switch (int switchnum, int prefix_length)
}
/* Otherwise the switch is live. */
- switches[switchnum].live_cond = SWITCH_LIVE;
+ switches[switchnum].live_cond |= SWITCH_LIVE;
return 1;
}
@@ -5969,7 +5968,7 @@ check_live_switch (int switchnum, int prefix_length)
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)
@@ -7135,7 +7134,7 @@ used_arg (const char *p, int len)
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++)