Commit 41e16835 by Jason Merrill

x

From-SVN: r14225
parent d7d775a0
...@@ -493,6 +493,38 @@ savestring (input, size) ...@@ -493,6 +493,38 @@ savestring (input, size)
output[size] = 0; output[size] = 0;
return output; return output;
} }
/* Parse a reasonable subset of shell quoting syntax. */
static char *
extract_string (pp)
char **pp;
{
char *p = *pp;
int backquote = 0;
int inside = 0;
for (;;)
{
char c = *p;
if (c == '\0')
break;
++p;
if (backquote)
obstack_1grow (&temporary_obstack, c);
else if (! inside && c == ' ')
break;
else if (! inside && c == '\\')
backquote = 1;
else if (c == '\'')
inside = !inside;
else
obstack_1grow (&temporary_obstack, c);
}
*pp = p;
return obstack_finish (&temporary_obstack);
}
void void
dump_file (name) dump_file (name)
...@@ -957,17 +989,13 @@ main (argc, argv) ...@@ -957,17 +989,13 @@ main (argc, argv)
putenv (p); putenv (p);
p = (char *) getenv ("COLLECT_GCC_OPTIONS"); p = (char *) getenv ("COLLECT_GCC_OPTIONS");
if (p) while (p && *p)
while (*p) {
{ char *q = extract_string (&p);
char *q = p; if (*q == '-' && (q[1] == 'm' || q[1] == 'f'))
while (*q && *q != ' ') q++; num_c_args++;
if (*p == '-' && p[1] == 'm') }
num_c_args++; obstack_free (&temporary_obstack, temporary_firstobj);
if (*q) q++;
p = q;
}
c_ptr = c_argv = (char **) xcalloc (sizeof (char *), num_c_args); c_ptr = c_argv = (char **) xcalloc (sizeof (char *), num_c_args);
...@@ -1254,19 +1282,15 @@ main (argc, argv) ...@@ -1254,19 +1282,15 @@ main (argc, argv)
/* Get any options that the upper GCC wants to pass to the sub-GCC. */ /* Get any options that the upper GCC wants to pass to the sub-GCC. */
p = (char *) getenv ("COLLECT_GCC_OPTIONS"); p = (char *) getenv ("COLLECT_GCC_OPTIONS");
if (p) while (p && *p)
while (*p) {
{ char *q = extract_string (&p);
char *q = p; if (*q == '-' && (q[1] == 'm' || q[1] == 'f'))
while (*q && *q != ' ') q++; *c_ptr++ = obstack_copy0 (&permanent_obstack, q, strlen (q));
if (*p == '-' && (p[1] == 'm' || p[1] == 'f')) if (strncmp (q, "-shared", sizeof ("shared") - 1) == 0)
*c_ptr++ = savestring (p, q - p); shared_obj = 1;
if (strncmp (p, "-shared", sizeof ("shared") - 1) == 0) }
shared_obj = 1; obstack_free (&temporary_obstack, temporary_firstobj);
if (*q) q++;
p = q;
}
#ifdef COLLECT_EXPORT_LIST #ifdef COLLECT_EXPORT_LIST
/* The AIX linker will discard static constructors in object files if /* The AIX linker will discard static constructors in object files if
......
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