diff options
author | Jakub Jelinek <jakub@redhat.com> | 2013-03-05 07:01:13 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2013-03-05 07:01:13 +0100 |
commit | a5d1569a6dd3126faf40b9aee31555438918fba4 (patch) | |
tree | 649d75376ecf5d33772557e4545a55a3e2b48c45 | |
parent | da56a169acdafa93cf79c058360de06e5530945e (diff) | |
download | gcc-a5d1569a6dd3126faf40b9aee31555438918fba4.tar.gz |
re PR bootstrap/56509 (gnattools build failure)
PR bootstrap/56509
* opts.c (opts_obstack, opts_concat): Moved to...
* opts-common.c (opts_obstack, opts_concat): ... here.
From-SVN: r196449
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/opts-common.c | 34 | ||||
-rw-r--r-- | gcc/opts.c | 34 |
3 files changed, 40 insertions, 34 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 15897c51ce9..630ed9fa899 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-03-05 Jakub Jelinek <jakub@redhat.com> + + PR bootstrap/56509 + * opts.c (opts_obstack, opts_concat): Moved to... + * opts-common.c (opts_obstack, opts_concat): ... here. + 2013-03-04 Jakub Jelinek <jakub@redhat.com> PR middle-end/56461 diff --git a/gcc/opts-common.c b/gcc/opts-common.c index 95ca5841acc..9d186a759cb 100644 --- a/gcc/opts-common.c +++ b/gcc/opts-common.c @@ -692,6 +692,40 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask, return result; } +/* Obstack for option strings. */ + +struct obstack opts_obstack; + +/* Like libiberty concat, but allocate using opts_obstack. */ + +char * +opts_concat (const char *first, ...) +{ + char *newstr, *end; + size_t length = 0; + const char *arg; + va_list ap; + + /* First compute the size of the result and get sufficient memory. */ + va_start (ap, first); + for (arg = first; arg; arg = va_arg (ap, const char *)) + length += strlen (arg); + newstr = XOBNEWVEC (&opts_obstack, char, length + 1); + va_end (ap); + + /* Now copy the individual pieces to the result string. */ + va_start (ap, first); + for (arg = first, end = newstr; arg; arg = va_arg (ap, const char *)) + { + length = strlen (arg); + memcpy (end, arg, length); + end += length; + } + *end = '\0'; + va_end (ap); + return newstr; +} + /* Decode command-line options (ARGC and ARGV being the arguments of main) into an array, setting *DECODED_OPTIONS to a pointer to that array and *DECODED_OPTIONS_COUNT to the number of entries in the diff --git a/gcc/opts.c b/gcc/opts.c index d569b5e7e90..45b12fecb8e 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -268,40 +268,6 @@ add_comma_separated_to_vector (void **pvec, const char *arg) *pvec = v; } -/* Like libiberty concat, but allocate using opts_obstack. */ - -char * -opts_concat (const char *first, ...) -{ - char *newstr, *end; - size_t length = 0; - const char *arg; - va_list ap; - - /* First compute the size of the result and get sufficient memory. */ - va_start (ap, first); - for (arg = first; arg; arg = va_arg (ap, const char *)) - length += strlen (arg); - newstr = XOBNEWVEC (&opts_obstack, char, length + 1); - va_end (ap); - - /* Now copy the individual pieces to the result string. */ - va_start (ap, first); - for (arg = first, end = newstr; arg; arg = va_arg (ap, const char *)) - { - length = strlen (arg); - memcpy (end, arg, length); - end += length; - } - *end = '\0'; - va_end (ap); - return newstr; -} - -/* Obstack for option strings. */ - -struct obstack opts_obstack; - /* Initialize OPTS and OPTS_SET before using them in parsing options. */ void |