From fd5e7009f67a8fbbb80019d60f772124699b5205 Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Mon, 10 Jun 1996 18:53:21 +0000 Subject: [PATCH] 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 --- gcc/gcc.c | 31 ++++++++++++++++++++----------- 1 file 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; -- 2.7.4