str: fix tests on unsigned chars, and !HAVE_ISBLANK.
authorRusty Russell <rusty@rustcorp.com.au>
Wed, 27 Apr 2011 06:35:43 +0000 (16:05 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 27 Apr 2011 06:38:49 +0000 (16:08 +0930)
13 files changed:
ccan/str/test/compile_fail-isalnum.c
ccan/str/test/compile_fail-isalpha.c
ccan/str/test/compile_fail-isascii.c
ccan/str/test/compile_fail-isblank.c
ccan/str/test/compile_fail-iscntrl.c
ccan/str/test/compile_fail-isdigit.c
ccan/str/test/compile_fail-islower.c
ccan/str/test/compile_fail-isprint.c
ccan/str/test/compile_fail-ispunct.c
ccan/str/test/compile_fail-isspace.c
ccan/str/test/compile_fail-isupper.c
ccan/str/test/compile_fail-isxdigit.c
tools/configurator/configurator.c

index 1b6a3633bdd3234e15b0352d0efd789e551c3632..930defffa0c231862679e42ddb851655cf5a93a1 100644 (file)
@@ -15,8 +15,7 @@ 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
 
        return isalnum(c);
index 76de15041ce537a876ce8bd15c32a07b5e33af02..2005109829be36e1ea558e287b770d9fbb1cc663 100644 (file)
@@ -15,8 +15,7 @@ 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
 
        return isalpha(c);
index af6e64d5d2653cc68a3f365cbdb53077a97f39d8..ee55e4997434c5cd4c11c01a0bd45d28af67d37d 100644 (file)
@@ -15,8 +15,7 @@ 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
 
        return isascii(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
 }
index 5ae783b126a4b6d989bee3a16290203dc7f59f08..bc74146542f1b36ecefe1fb394bfb84254d4b571 100644 (file)
@@ -15,8 +15,7 @@ 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
 
        return iscntrl(c);
index 68d81ba4fcd67b8987198316d691639e609a55c4..71d1c714330f2cf9f363e46a3161a4e0f5c9e93c 100644 (file)
@@ -15,8 +15,7 @@ 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
 
        return isdigit(c);
index 9dec95f69a0881cbe530a62c4e2abac849fda6d5..ca3f9907e52087eefb75d6f40831f11c50b12e8e 100644 (file)
@@ -15,8 +15,7 @@ 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
 
        return islower(c);
index 30f7639c42ea3704a67ded1fb5ec207a9ca7ba92..6432e41d2b7db9db5ddc0ecd35611fcc169e49d3 100644 (file)
@@ -15,8 +15,7 @@ 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
 
        return isprint(c);
index f1ae13ac6da3f04ee4be37e0ecd799e05320e5de..5d941fcba687a23863780acc6076479ba05bfcd8 100644 (file)
@@ -15,8 +15,7 @@ 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
 
        return ispunct(c);
index c94c49e4893cc506c30df90bf4f217b7c593f50d..bfee1f89f166614b603b9aec5c2315ad430a3af0 100644 (file)
@@ -15,8 +15,7 @@ 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
 
        return isspace(c);
index f23dd659c70ac9fee3b3d2846f2a1891a2c08ea7..4cf9fd35785c37e40e1ea16529845886896381f8 100644 (file)
@@ -15,8 +15,7 @@ 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
 
        return isupper(c);
index 6a7377fd6d16862a7efad1b90a9b2bbd5c80123f..65e6006a885b029ae7cec620a44aebd652567e22 100644 (file)
@@ -15,8 +15,7 @@ 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
 
        return isxdigit(c);
index 7b9652be90ef096045ce1545f84b9c1afa5b05ec..b78b112f4a9f0b523de52a4b212bc12b17fa9fad 100644 (file)
@@ -116,6 +116,7 @@ static struct test tests[] = {
          "#include <unistd.h>\n"
          "static int func(void) { return getpagesize(); }" },
        { "HAVE_ISBLANK", DEFINES_FUNC, NULL,
+         "#define _GNU_SOURCE\n"
          "#include <ctype.h>\n"
          "static int func(void) { return isblank(' '); }" },
        { "HAVE_LITTLE_ENDIAN", INSIDE_MAIN|EXECUTE, NULL,