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] Make rs6000 port bootstrap using G++ as 2nd/3rd stage compilers


I tried building the powerpc64-linux compiler today, and it would not
bootstrap, since evidently stages 2 and 3 are built with G++ instead of C, and
G++ is more strict about const pointers.

This patch allows the compiler to bootstrap.  Is it ok to install?

2011-07-20  Michael Meissner  <meissner@linux.vnet.ibm.com>

	* config/rs6000/rs6000.c (rs6000_xcoff_strip_dollar): Rewrite to
	avoid warnings when GCC is built with a C++ compiler.

Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	(revision 176521)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -21893,8 +21893,9 @@ toc_hash_eq (const void *h1, const void 
 const char *
 rs6000_xcoff_strip_dollar (const char *name)
 {
-  char *strip, *p;
-  int len;
+  char *strip;
+  const char *p;
+  size_t len, i;
 
   p = strchr (name, '$');
 
@@ -21902,13 +21903,11 @@ rs6000_xcoff_strip_dollar (const char *n
     return name;
 
   len = strlen (name);
-  strip = (char *) alloca (len + 1);
-  strcpy (strip, name);
-  p = strchr (strip, '$');
-  while (p)
+  strip = XALLOCAVEC (char, len);
+  for (i = 0; i < len; i++)
     {
-      *p = '_';
-      p = strchr (p + 1, '$');
+      int ch = name[i];
+      strip[i] = (ch == '$') ? '_' : ch;
     }
 
   return ggc_alloc_string (strip, len);


-- 
Michael Meissner, IBM
5 Technology Place Drive, M/S 2757, Westford, MA 01886-3141, USA
meissner@linux.vnet.ibm.com	fax +1 (978) 399-6899


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