Commit 53117a2f by Richard Kenner

(compiler_version): New variable.

(spec_version): Initialize from DEFAULT_TARGET_VERSION.
(main): Distinguish COMPILER_VERSION from TARGET_VERSION.
(process_command): Use COMPILER_VERSION for %v.
Guard against a COMPILER_VERSION that lacks a minor.

From-SVN: r6264
parent 964ceda1
...@@ -131,9 +131,13 @@ static int verbose_flag; ...@@ -131,9 +131,13 @@ static int verbose_flag;
static int save_temps_flag; static int save_temps_flag;
/* The compiler version specified with -V */ /* The compiler version. */
static char *spec_version; static char *compiler_version;
/* The target version specified with -V */
static char *spec_version = DEFAULT_TARGET_VERSION;
/* The target machine specified with -b. */ /* The target machine specified with -b. */
...@@ -2114,10 +2118,17 @@ process_command (argc, argv) ...@@ -2114,10 +2118,17 @@ process_command (argc, argv)
n_switches = 0; n_switches = 0;
n_infiles = 0; n_infiles = 0;
/* Default for -V is our version number, ending at first space. */ /* Figure compiler version from version string. */
spec_version = save_string (version_string, strlen (version_string));
for (temp = spec_version; *temp && *temp != ' '; temp++); compiler_version = save_string (version_string, strlen (version_string));
if (*temp) *temp = '\0'; for (temp = compiler_version; *temp; ++temp)
{
if (*temp == ' ')
{
*temp = '\0';
break;
}
}
/* Set up the default search paths. */ /* Set up the default search paths. */
...@@ -2394,6 +2405,7 @@ process_command (argc, argv) ...@@ -2394,6 +2405,7 @@ process_command (argc, argv)
spec_version = argv[++i]; spec_version = argv[++i];
else else
spec_version = p + 1; spec_version = p + 1;
compiler_version = spec_version;
break; break;
case 's': case 's':
...@@ -3357,20 +3369,29 @@ do_spec_1 (spec, inswitch, soft_matched_part) ...@@ -3357,20 +3369,29 @@ do_spec_1 (spec, inswitch, soft_matched_part)
case 'v': case 'v':
{ {
int c1 = *p++; /* Select first or second version number. */ int c1 = *p++; /* Select first or second version number. */
char *p = spec_version; char *v = compiler_version;
char *q, *copy; char *q, *copy;
/* If desired, advance to second version number. */ /* If desired, advance to second version number. */
if (c1 == '2') if (c1 == '2')
{ {
/* Set P after the first period. */ /* Set P after the first period. */
while (*p != '.') p++; while (*v != 0 && *v != ' ' && *v != '.')
p++; v++;
if (*v == '.')
v++;
} }
/* Set Q at the next period or at the end. */ /* Set Q at the next period or at the end. */
q = p; q = v;
while (*q != '.' && *q != 0) q++; while (*q != 0 && *q != ' ' && *q != '.')
q++;
/* Empty string means zero. */
if (p == q)
{
v = "0";
q = v + 1;
}
/* Put that part into the command. */ /* Put that part into the command. */
obstack_grow (&obstack, p, q - p); obstack_grow (&obstack, v, q - v);
arg_going = 1; arg_going = 1;
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment