summaryrefslogtreecommitdiff
path: root/gcc/gcc.c
diff options
context:
space:
mode:
authorJie Zhang <jie@codesourcery.com>2011-02-23 02:04:43 +0000
committerJie Zhang <jiez@gcc.gnu.org>2011-02-23 02:04:43 +0000
commit7fcf46f509414d97aea64a10f441781ad8c4b9de (patch)
treeda36449698452cc5da633bd67569a6ff13a6529d /gcc/gcc.c
parentf85b70fda4fca7f96777eebef3956383bbf4771f (diff)
downloadgcc-7fcf46f509414d97aea64a10f441781ad8c4b9de.tar.gz
opts-common.c (decode_cmdline_option): Print empty string argument as "" in decoded->orig_option_with_args_text.
* opts-common.c (decode_cmdline_option): Print empty string argument as "" in decoded->orig_option_with_args_text. * gcc.c (execute): Print empty string argument as "" in the verbose output. (do_spec_1): Keep empty string argument. testsuite/ * gcc.dg/cpp/include7.c: New test. From-SVN: r170426
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r--gcc/gcc.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 6a26aafc3ca..75f522e1db5 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -2538,13 +2538,20 @@ execute (void)
}
fputc ('"', stderr);
}
+ /* If it's empty, print "". */
+ else if (!**j)
+ fprintf (stderr, " \"\"");
else
fprintf (stderr, " %s", *j);
}
}
else
for (j = commands[i].argv; *j; j++)
- fprintf (stderr, " %s", *j);
+ /* If it's empty, print "". */
+ if (!**j)
+ fprintf (stderr, " \"\"");
+ else
+ fprintf (stderr, " %s", *j);
/* Print a pipe symbol after all but the last command. */
if (i + 1 != n_commands)
@@ -4423,6 +4430,10 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
int i;
int value;
+ /* If it's an empty string argument to a switch, keep it as is. */
+ if (inswitch && !*p)
+ arg_going = 1;
+
while ((c = *p++))
/* If substituting a switch, treat all chars like letters.
Otherwise, NL, SPC, TAB and % are special. */
@@ -5149,7 +5160,8 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
case '*':
if (soft_matched_part)
{
- do_spec_1 (soft_matched_part, 1, NULL);
+ if (soft_matched_part[0])
+ do_spec_1 (soft_matched_part, 1, NULL);
do_spec_1 (" ", 0, NULL);
}
else