aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDoug Evans <dje@gnu.org>1996-06-10 18:53:21 +0000
committerDoug Evans <dje@gnu.org>1996-06-10 18:53:21 +0000
commitfd5e7009f67a8fbbb80019d60f772124699b5205 (patch)
tree3a1551ed105201e3e89266e838562a4fcf0b4bb2 /gcc
parent8cfe18d616b72d9d8bf9ebe40c9a1c10be9f3f24 (diff)
downloadgcc-fd5e7009f67a8fbbb80019d60f772124699b5205.zip
gcc-fd5e7009f67a8fbbb80019d60f772124699b5205.tar.gz
gcc-fd5e7009f67a8fbbb80019d60f772124699b5205.tar.bz2
gcc.c (do_spec_1): Allow leading text in version string.
* gcc.c (do_spec_1): Allow leading text in version string. Delete support for default minor number = 0. From-SVN: r12264
Diffstat (limited to 'gcc')
-rw-r--r--gcc/gcc.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 8ca9313..16a8db4 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -3735,26 +3735,35 @@ do_spec_1 (spec, inswitch, soft_matched_part)
{
int c1 = *p++; /* Select first or second version number. */
char *v = compiler_version;
- char *q, *copy;
+ char *q;
+
+ /* The format of the version string is
+ ([^0-9]*-)?[0-9]+[.][0-9]+([.][0-9]+)?([- ].*)? */
+
+ /* Ignore leading non-digits. i.e. "foo-" in "foo-2.7.2". */
+ while (! isdigit (*v))
+ v++;
+ if (v > compiler_version && v[-1] != '-')
+ abort ();
+
/* If desired, advance to second version number. */
if (c1 == '2')
{
/* Set V after the first period. */
- while (*v != 0 && *v != ' ' && *v != '.')
- v++;
- if (*v == '.')
+ while (isdigit (*v))
v++;
+ if (*v != '.')
+ abort ();
+ v++;
}
+
/* Set Q at the next period or at the end. */
q = v;
- while (*q != 0 && *q != ' ' && *q != '.')
+ while (isdigit (*q))
q++;
- /* Empty string means zero. */
- if (v == q)
- {
- v = "0";
- q = v + 1;
- }
+ if (*q != 0 && *q != ' ' && *q != '.' && *q != '-')
+ abort ();
+
/* Put that part into the command. */
obstack_grow (&obstack, v, q - v);
arg_going = 1;