+2011-02-23 Jie Zhang <jie@codesourcery.com>
+
+ * 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.
+
2011-02-23 Nathan Froyd <froydnj@codesourcery.com>
* config.gcc: Declare score-* and crx-* obsolete.
}
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)
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. */
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
{
if (i < result)
{
+ size_t len;
if (opt_index == OPT_SPECIAL_unknown)
decoded->canonical_option[i] = argv[i];
else
decoded->canonical_option[i] = NULL;
- total_len += strlen (argv[i]) + 1;
+ len = strlen (argv[i]);
+ /* If the argument is an empty string, we will print it as "" in
+ orig_option_with_args_text. */
+ total_len += (len != 0 ? len : 2) + 1;
}
else
decoded->canonical_option[i] = NULL;
{
size_t len = strlen (argv[i]);
- memcpy (p, argv[i], len);
+ /* Print the empty string verbally. */
+ if (len == 0)
+ {
+ *p++ = '"';
+ *p++ = '"';
+ }
+ else
+ memcpy (p, argv[i], len);
p += len;
if (i == result - 1)
*p++ = 0;