]> git.ozlabs.org Git - ccan/blobdiff - ccan/str/test/compile_fail-isblank.c
str: fix tests on unsigned chars, and !HAVE_ISBLANK.
[ccan] / ccan / str / test / compile_fail-isblank.c
index 86a33503dab00fb0f3007f4c5c066030ad602c22..f4cb961d740d9dd0bc9b99825a3af51d3d50d848 100644 (file)
@@ -4,7 +4,7 @@
 int main(int argc, char *argv[])
 {
 #ifdef FAIL
-#if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF
+#if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF || !HAVE_ISBLANK
 #error We need typeof to check isblank.
 #endif
        char
@@ -15,9 +15,12 @@ int main(int argc, char *argv[])
 
 #ifdef FAIL
        /* Fake fail on unsigned char platforms. */
-       c = 255;
-       BUILD_ASSERT(c < 0);
+       BUILD_ASSERT((char)255 < 0);
 #endif
 
+#if HAVE_ISBLANK
        return isblank(c);
+#else
+       return c;
+#endif
 }