aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2010-05-11 06:50:24 +0000
committerJakub Jelinek <jakub@redhat.com>2010-05-11 06:50:24 +0000
commitad36d40ede56da44f557242508fd3c08920f79d7 (patch)
tree8f7588d5feab29a97a6a9665a37867bf8904390c
parent816bb7ce7fa68320d4a4bfcb193b437ae5659c90 (diff)
* gcc.c (execute): For -### don't quote arguments that
contain just alphanumerics and _/-. characters. * doc/invoke.texi: Document that change for -###. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@159255 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/doc/invoke.texi6
-rw-r--r--gcc/gcc.c19
3 files changed, 21 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 07aad7be5c0..40eef0289ba 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
2010-05-11 Jakub Jelinek <jakub@redhat.com>
+ * gcc.c (execute): For -### don't quote arguments that
+ contain just alphanumerics and _/-. characters.
+ * doc/invoke.texi: Document that change for -###.
+
PR debug/44023
* df-problems.c (struct dead_debug): Add to_rescan field.
(dead_debug_init): Clear to_rescan field.
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 33e4612a10a..98f97cc2d50 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -1172,9 +1172,9 @@ program and of the preprocessor and the compiler proper.
@item -###
@opindex ###
-Like @option{-v} except the commands are not executed and all command
-arguments are quoted. This is useful for shell scripts to capture the
-driver-generated command lines.
+Like @option{-v} except the commands are not executed and arguments
+are quoted unless they contain only alphanumeric characters or @code{./-_}.
+This is useful for shell scripts to capture the driver-generated command lines.
@item -pipe
@opindex pipe
diff --git a/gcc/gcc.c b/gcc/gcc.c
index e2644c4a73e..6455437a907 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -3020,14 +3020,23 @@ execute (void)
for (j = commands[i].argv; *j; j++)
{
const char *p;
- fprintf (stderr, " \"");
for (p = *j; *p; ++p)
+ if (!ISALNUM ((unsigned char) *p)
+ && *p != '_' && *p != '/' && *p != '-' && *p != '.')
+ break;
+ if (*p || !*j)
{
- if (*p == '"' || *p == '\\' || *p == '$')
- fputc ('\\', stderr);
- fputc (*p, stderr);
+ fprintf (stderr, " \"");
+ for (p = *j; *p; ++p)
+ {
+ if (*p == '"' || *p == '\\' || *p == '$')
+ fputc ('\\', stderr);
+ fputc (*p, stderr);
+ }
+ fputc ('"', stderr);
}
- fputc ('"', stderr);
+ else
+ fprintf (stderr, " %s", *j);
}
}
else