diff options
author | jiez <jiez@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-02-23 02:04:43 +0000 |
---|---|---|
committer | jiez <jiez@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-02-23 02:04:43 +0000 |
commit | fde5bd5c53d98e14c06413cde7ce4ada0d89cc8d (patch) | |
tree | da36449698452cc5da633bd67569a6ff13a6529d /gcc/opts-common.c | |
parent | 269a3896de28a125b25303fb66d4fee7209aface (diff) | |
download | gcc-fde5bd5c53d98e14c06413cde7ce4ada0d89cc8d.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170426 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/opts-common.c')
-rw-r--r-- | gcc/opts-common.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/gcc/opts-common.c b/gcc/opts-common.c index 3c4044a2063..f958b7ed953 100644 --- a/gcc/opts-common.c +++ b/gcc/opts-common.c @@ -607,11 +607,15 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask, { 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; @@ -637,7 +641,14 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask, { 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; |