This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Move opts_{obstack,concat} from opts.c to opts-common.c (PR bootstrap/56509)


Hi!

gnattools apparently link in parts of libtarget* without linking against
libstdc++/libsupc++, so my recent change where opts.o has been brought in
on powerpc when before only opts-common.o has been linked in caused
a bootstrap regression.

Fixed by moving opts_{obstack,concat} to opts-common.o.

Bootstrapped/regtested on {x86_64,i686,powerpc{,64}}-linux, ok for trunk?

2013-03-04  Jakub Jelinek  <jakub@redhat.com>

	PR bootstrap/56509
	* opts.c (opts_obstack, opts_concat): Moved to...
	* opts-common.c (opts_obstack, opts_concat): ... here.

--- gcc/opts-common.c.jj	2013-02-27 08:27:26.000000000 +0100
+++ gcc/opts-common.c	2013-03-04 10:02:58.016096542 +0100
@@ -692,6 +692,40 @@ decode_cmdline_option (const char **argv
   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
--- gcc/opts.c.jj	2013-02-27 08:27:26.000000000 +0100
+++ gcc/opts.c	2013-03-04 10:02:16.401346992 +0100
@@ -268,40 +268,6 @@ add_comma_separated_to_vector (void **pv
   *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

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]