diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-02-27 07:28:09 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-02-27 07:28:09 +0000 |
commit | ba30d3378b0b1e4bdc9f054c7dc507b212ebf74b (patch) | |
tree | bd4cfc1abd9fbaa6e8743ef8ed88707b9b753706 /gcc/opts-common.c | |
parent | d5417a490ff4fec810a67dc82d51921d735e16f8 (diff) | |
download | gcc-ba30d3378b0b1e4bdc9f054c7dc507b212ebf74b.tar.gz |
* opts.h: Include obstack.h.
(opts_concat): New prototype.
(opts_obstack): New declaration.
* opts.c (opts_concat): New function.
(opts_obstack): New variable.
(init_options_struct): Call gcc_init_obstack on opts_obstack.
(finish_options): Use opts_concat instead of concat
and XOBNEWVEC instead of XNEWVEC.
* opts-common.c (generate_canonical_option, decode_cmdline_option,
generate_option): Likewise.
* Makefile.in (OPTS_H): Depend on $(OBSTACK_H).
* lto-wrapper.c (main): Call gcc_init_obstack on opts_obstack.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@196305 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/opts-common.c')
-rw-r--r-- | gcc/opts-common.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/gcc/opts-common.c b/gcc/opts-common.c index 1dd872a638c..95ca5841acc 100644 --- a/gcc/opts-common.c +++ b/gcc/opts-common.c @@ -276,7 +276,7 @@ generate_canonical_option (size_t opt_index, const char *arg, int value, && !option->cl_reject_negative && (opt_text[1] == 'W' || opt_text[1] == 'f' || opt_text[1] == 'm')) { - char *t = XNEWVEC (char, option->opt_len + 5); + char *t = XOBNEWVEC (&opts_obstack, char, option->opt_len + 5); t[0] = '-'; t[1] = opt_text[1]; t[2] = 'n'; @@ -301,11 +301,9 @@ generate_canonical_option (size_t opt_index, const char *arg, int value, else { gcc_assert (option->flags & CL_JOINED); - decoded->canonical_option[0] = concat (opt_text, arg, NULL); + decoded->canonical_option[0] = opts_concat (opt_text, arg, NULL); decoded->canonical_option[1] = NULL; decoded->canonical_option_num_elements = 1; - if (opt_text != option->opt_text) - free (CONST_CAST (char *, opt_text)); } } else @@ -590,7 +588,7 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask, { size_t j; size_t len = strlen (arg); - char *arg_lower = XNEWVEC (char, len + 1); + char *arg_lower = XOBNEWVEC (&opts_obstack, char, len + 1); for (j = 0; j < len; j++) arg_lower[j] = TOLOWER ((unsigned char) arg[j]); @@ -670,7 +668,8 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask, decoded->canonical_option_num_elements = result; } } - decoded->orig_option_with_args_text = p = XNEWVEC (char, total_len); + decoded->orig_option_with_args_text + = p = XOBNEWVEC (&opts_obstack, char, total_len); for (i = 0; i < result; i++) { size_t len = strlen (argv[i]); @@ -932,8 +931,8 @@ generate_option (size_t opt_index, const char *arg, int value, case 2: decoded->orig_option_with_args_text - = concat (decoded->canonical_option[0], " ", - decoded->canonical_option[1], NULL); + = opts_concat (decoded->canonical_option[0], " ", + decoded->canonical_option[1], NULL); break; default: |