From b08dec2fb20721e271504690dad8f32c7471fd01 Mon Sep 17 00:00:00 2001 From: Dominique d'Humieres Date: Thu, 13 Nov 2014 22:06:15 +0000 Subject: [PATCH] re PR bootstrap/63853 (The use of strchrnul breaks bootstrap on x86_64-apple-darwin14.) 2014-11-13 Dominique Dhumieres PR bootstrap/63853 gcc/ * gcc.c (handle_foffload_option): Replace strchrnul with strchr. * lto-wrapper.c (parse_env_var, append_offload_options): Likewise. From-SVN: r217524 --- gcc/ChangeLog | 6 ++++++ gcc/gcc.c | 16 ++++++++++++---- gcc/lto-wrapper.c | 12 +++++++++--- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5fe28340d3c..25da2a0815d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-11-13 Dominique Dhumieres + + PR bootstrap/63853 + * gcc.c (handle_foffload_option): Replace strchrnul with strchr. + * lto-wrapper.c (parse_env_var, append_offload_options): Likewise. + 2014-11-13 Alan Lawrence * fold-const.c (const_binop): Remove code handling VEC_RSHIFT_EXPR. diff --git a/gcc/gcc.c b/gcc/gcc.c index 4422fa038e8..653ca8db9f6 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -3375,12 +3375,16 @@ handle_foffload_option (const char *arg) 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 @@ handle_foffload_option (const char *arg) 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 @@ handle_foffload_option (const char *arg) 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) diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c index de73ebcdb8b..951a2ddc787 100644 --- a/gcc/lto-wrapper.c +++ b/gcc/lto-wrapper.c @@ -424,7 +424,9 @@ parse_env_var (const char *str, char ***pvalues, const char *append) 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 @@ parse_env_var (const char *str, char ***pvalues, const char *append) 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 @@ append_offload_options (obstack *argv_obstack, const char *target, 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) -- 2.30.2