aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNeil Booth <neil@gcc.gnu.org>2000-11-22 19:17:14 +0000
committerNeil Booth <neil@gcc.gnu.org>2000-11-22 19:17:14 +0000
commit10ebf5fe407fda5d092f23e50b26272d13bb1106 (patch)
tree6ac492e3e33761ee32ecc7a71fcec680adf93216 /gcc
parent4f3d0af4a41b74fde1447a0c6081e20b55e8476c (diff)
downloadgcc-10ebf5fe407fda5d092f23e50b26272d13bb1106.zip
gcc-10ebf5fe407fda5d092f23e50b26272d13bb1106.tar.gz
gcc-10ebf5fe407fda5d092f23e50b26272d13bb1106.tar.bz2
gcc.c (validate_switches): Validate multiple switches named in '|' (or) expressions in specs.
* gcc.c (validate_switches): Validate multiple switches named in '|' (or) expressions in specs. (handle_braces): If more than 1 alternative in a '|' spec matches, call do_spec1 just once. From-SVN: r37667
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/gcc.c28
2 files changed, 27 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5b54a90..d6187a5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2000-11-22 Chris Demetriou <cgd@sibyte.com>
+2000-11-22 Neil Booth <neilb@earthling.net>
+
+ * gcc.c (validate_switches): Validate multiple switches named
+ in '|' (or) expressions in specs.
+ (handle_braces): If more than 1 alternative in a '|' spec
+ matches, call do_spec1 just once.
+
2000-11-22 Michael Meissner <meissner@redhat.com>
* d30v.h (TARGET_SWITCHES): Add documentation strings.
diff --git a/gcc/gcc.c b/gcc/gcc.c
index f7d5a9a..074cd6a 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -4720,6 +4720,7 @@ handle_braces (p)
{
const char *filter, *body = NULL, *endbody = NULL;
int pipe_p = 0;
+ int true_once = 0; /* If, in %{a|b:d}, at least one of a,b was seen. */
int negate;
int suffix;
int include_blanks = 1;
@@ -4924,11 +4925,8 @@ next_member:
give_switch (i, 0, include_blanks);
}
else
- {
- if (do_spec_1 (save_string (body, endbody - body - 1),
- 0, NULL_PTR) < 0)
- return 0;
- }
+ /* Even if many alternatives are matched, only output once. */
+ true_once = 1;
}
else if (pipe_p)
{
@@ -4943,6 +4941,14 @@ next_member:
if (*p++ == '|')
goto next_member;
+ /* Process the spec just once, regardless of match count. */
+ if (true_once)
+ {
+ if (do_spec_1 (save_string (body, endbody - body - 1),
+ 0, NULL_PTR) < 0)
+ return 0;
+ }
+
return endbody;
}
@@ -5938,19 +5944,21 @@ validate_switches (start)
register const char *p = start;
const char *filter;
register int i;
- int suffix = 0;
+ int suffix;
if (*p == '|')
++p;
+next_member:
if (*p == '!')
++p;
+ suffix = 0;
if (*p == '.')
suffix = 1, ++p;
filter = p;
- while (*p != ':' && *p != '}')
+ while (*p != ':' && *p != '}' && *p != '|')
p++;
if (suffix)
@@ -5958,9 +5966,8 @@ validate_switches (start)
else if (p[-1] == '*')
{
/* Mark all matching switches as valid. */
- --p;
for (i = 0; i < n_switches; i++)
- if (!strncmp (switches[i].part1, filter, p - filter))
+ if (!strncmp (switches[i].part1, filter, p - filter - 1))
switches[i].validated = 1;
}
else
@@ -5973,6 +5980,9 @@ validate_switches (start)
switches[i].validated = 1;
}
}
+
+ if (*p++ == '|')
+ goto next_member;
}
/* Check whether a particular argument was used. The first time we