Summary: | piglit-util.h:308:8: error: cannot initialize a variable of type 'char *' with an rvalue of type 'const char *' | ||
---|---|---|---|
Product: | piglit | Reporter: | Vinson Lee <vlee> |
Component: | tests | Assignee: | Piglit Mailing List <piglit> |
Status: | RESOLVED FIXED | QA Contact: | Piglit Mailing List <piglit> |
Severity: | normal | ||
Priority: | medium | CC: | emil.l.velikov |
Version: | unspecified | ||
Hardware: | x86-64 (AMD64) | ||
OS: | Mac OS X (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: |
Description
Vinson Lee
2017-10-12 21:52:16 UTC
If you change the declaration to this, does that help? const char *t = strchr(s, c); (In reply to Brian Paul from comment #1) > If you change the declaration to this, does that help? > > const char *t = strchr(s, c); No, I get this error with that change. piglit-util.h:310:9: error: cannot initialize return object of type 'char *' with an rvalue of type 'const char *' return (t == NULL) ? ((char *) s + strlen(s)) : t; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ How about this? return (t == NULL) ? ((char *) s + strlen(s)) : (char *) t; (In reply to Brian Paul from comment #3) > How about this? > > return (t == NULL) ? ((char *) s + strlen(s)) : (char *) t; Yes, the combined two changes fixes the build error for me. diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h index c4e7818088a7..3d2fd7e0c575 100644 --- a/tests/util/piglit-util.h +++ b/tests/util/piglit-util.h @@ -305,9 +305,9 @@ strtol_hex(const char *nptr, char **endptr) static inline char * strchrnul(const char *s, int c) { - char *t = strchr(s, c); + const char *t = strchr(s, c); - return (t == NULL) ? ((char *) s + strlen(s)) : t; + return (t == NULL) ? ((char *) s + strlen(s)) : (char *) t; } #endif Patch posted to piglit mailing list for review. Vinson, I think your Reviewed-by or Tested-by would be enough for this patch. Fixed with commit 3ccf44531852a2d4bf0ea0d9f5e41e2c515d3e5d |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.