diff mbox

[COMMITTED] Fix PR63853 - Remove strchrnul to fix bootstrap on non-GNU platforms

Message ID 20141113221440.GC28110@msticlxl57.ims.intel.com
State New
Headers show

Commit Message

Ilya Verbin Nov. 13, 2014, 10:14 p.m. UTC
Hi,

I committed a patch from Dominique d'Humieres to restore bootsrap broken by
our offloading patches.

Thanks,
  -- Ilya


2014-11-13  Dominique Dhumieres  <dominiq@lps.ens.fr>

	PR bootstrap/63853
gcc/
	* gcc.c (handle_foffload_option): Replace strchrnul with strchr.
	* lto-wrapper.c (parse_env_var, append_offload_options): Likewise.
diff mbox

Patch

Index: gcc/gcc.c
===================================================================
--- gcc/gcc.c	(revision 217523)
+++ gcc/gcc.c	(working copy)
@@ -3375,12 +3375,16 @@ 
   if (arg[0] == '-')
     return;
 
-  end = strchrnul (arg, '=');
+  end = strchr (arg, '=');
+  if (end == NULL)
+    end = strchr (arg, '\0');
   cur = arg;
 
   while (cur < end)
     {
-      next = strchrnul (cur, ',');
+      next = strchr (cur, ',');
+      if (next == NULL)
+	next = strchr (cur, '\0');
       next = (next > end) ? end : next;
 
       target = XNEWVEC (char, next - cur + 1);
@@ -3400,7 +3404,9 @@ 
       c = OFFLOAD_TARGETS;
       while (c)
 	{
-	  n = strchrnul (c, ',');
+	  n = strchr (c, ',');
+	  if (n == NULL)
+	    n = strchr (c, '\0');
 
 	  if (strlen (target) == (size_t) (n - c)
 	      && strncmp (target, c, n - c) == 0)
@@ -3421,7 +3427,9 @@ 
 	  c = offload_targets;
 	  do
 	    {
-	      n = strchrnul (c, ':');
+	      n = strchr (c, ':');
+	      if (n == NULL)
+		n = strchr (c, '\0');
 
 	      if (strlen (target) == (size_t) (n - c)
 		  && strncmp (c, target, n - c) == 0)
Index: gcc/lto-wrapper.c
===================================================================
--- gcc/lto-wrapper.c	(revision 217523)
+++ gcc/lto-wrapper.c	(working copy)
@@ -424,7 +424,9 @@ 
 
   values = (char**) xmalloc (num * sizeof (char*));
   curval = str;
-  nextval = strchrnul (curval, ':');
+  nextval = strchr (curval, ':');
+  if (nextval == NULL)
+    nextval = strchr (curval, '\0');
 
   int append_len = append ? strlen (append) : 0;
   for (i = 0; i < num; i++)
@@ -436,7 +438,9 @@ 
       if (append)
 	strcat (values[i], append);
       curval = nextval + 1;
-      nextval = strchrnul (curval, ':');
+      nextval = strchr (curval, ':');
+      if (nextval == NULL)
+	nextval = strchr (curval, '\0');
     }
   *pvalues = values;
   return num;
@@ -581,7 +585,9 @@ 
 
 	  while (cur < opts)
 	    {
-	      next = strchrnul (cur, ',');
+	      next = strchr (cur, ',');
+	      if (next == NULL)
+		next = strchr (cur, '\0');
 	      next = (next > opts) ? opts : next;
 
 	      if (strlen (target) == (size_t) (next - cur)