summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2011-04-27 16:05:43 +0930
committerRusty Russell <rusty@rustcorp.com.au>2011-04-27 16:08:49 +0930
commit00e61068e33e7883a2657744514452a32660d461 (patch)
tree653aa29a59738407678235bbca41c9e7b5421669
parent5c922794aa81cb2a62a034552f6478074b4dda14 (diff)
str: fix tests on unsigned chars, and !HAVE_ISBLANK.
-rw-r--r--ccan/str/test/compile_fail-isalnum.c3
-rw-r--r--ccan/str/test/compile_fail-isalpha.c3
-rw-r--r--ccan/str/test/compile_fail-isascii.c3
-rw-r--r--ccan/str/test/compile_fail-isblank.c9
-rw-r--r--ccan/str/test/compile_fail-iscntrl.c3
-rw-r--r--ccan/str/test/compile_fail-isdigit.c3
-rw-r--r--ccan/str/test/compile_fail-islower.c3
-rw-r--r--ccan/str/test/compile_fail-isprint.c3
-rw-r--r--ccan/str/test/compile_fail-ispunct.c3
-rw-r--r--ccan/str/test/compile_fail-isspace.c3
-rw-r--r--ccan/str/test/compile_fail-isupper.c3
-rw-r--r--ccan/str/test/compile_fail-isxdigit.c3
-rw-r--r--tools/configurator/configurator.c1
13 files changed, 18 insertions, 25 deletions
diff --git a/ccan/str/test/compile_fail-isalnum.c b/ccan/str/test/compile_fail-isalnum.c
index 1b6a3633..930defff 100644
--- a/ccan/str/test/compile_fail-isalnum.c
+++ b/ccan/str/test/compile_fail-isalnum.c
@@ -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);
diff --git a/ccan/str/test/compile_fail-isalpha.c b/ccan/str/test/compile_fail-isalpha.c
index 76de1504..20051098 100644
--- a/ccan/str/test/compile_fail-isalpha.c
+++ b/ccan/str/test/compile_fail-isalpha.c
@@ -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);
diff --git a/ccan/str/test/compile_fail-isascii.c b/ccan/str/test/compile_fail-isascii.c
index af6e64d5..ee55e499 100644
--- a/ccan/str/test/compile_fail-isascii.c
+++ b/ccan/str/test/compile_fail-isascii.c
@@ -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);
diff --git a/ccan/str/test/compile_fail-isblank.c b/ccan/str/test/compile_fail-isblank.c
index 86a33503..f4cb961d 100644
--- a/ccan/str/test/compile_fail-isblank.c
+++ b/ccan/str/test/compile_fail-isblank.c
@@ -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
}
diff --git a/ccan/str/test/compile_fail-iscntrl.c b/ccan/str/test/compile_fail-iscntrl.c
index 5ae783b1..bc741465 100644
--- a/ccan/str/test/compile_fail-iscntrl.c
+++ b/ccan/str/test/compile_fail-iscntrl.c
@@ -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);
diff --git a/ccan/str/test/compile_fail-isdigit.c b/ccan/str/test/compile_fail-isdigit.c
index 68d81ba4..71d1c714 100644
--- a/ccan/str/test/compile_fail-isdigit.c
+++ b/ccan/str/test/compile_fail-isdigit.c
@@ -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);
diff --git a/ccan/str/test/compile_fail-islower.c b/ccan/str/test/compile_fail-islower.c
index 9dec95f6..ca3f9907 100644
--- a/ccan/str/test/compile_fail-islower.c
+++ b/ccan/str/test/compile_fail-islower.c
@@ -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);
diff --git a/ccan/str/test/compile_fail-isprint.c b/ccan/str/test/compile_fail-isprint.c
index 30f7639c..6432e41d 100644
--- a/ccan/str/test/compile_fail-isprint.c
+++ b/ccan/str/test/compile_fail-isprint.c
@@ -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);
diff --git a/ccan/str/test/compile_fail-ispunct.c b/ccan/str/test/compile_fail-ispunct.c
index f1ae13ac..5d941fcb 100644
--- a/ccan/str/test/compile_fail-ispunct.c
+++ b/ccan/str/test/compile_fail-ispunct.c
@@ -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);
diff --git a/ccan/str/test/compile_fail-isspace.c b/ccan/str/test/compile_fail-isspace.c
index c94c49e4..bfee1f89 100644
--- a/ccan/str/test/compile_fail-isspace.c
+++ b/ccan/str/test/compile_fail-isspace.c
@@ -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);
diff --git a/ccan/str/test/compile_fail-isupper.c b/ccan/str/test/compile_fail-isupper.c
index f23dd659..4cf9fd35 100644
--- a/ccan/str/test/compile_fail-isupper.c
+++ b/ccan/str/test/compile_fail-isupper.c
@@ -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);
diff --git a/ccan/str/test/compile_fail-isxdigit.c b/ccan/str/test/compile_fail-isxdigit.c
index 6a7377fd..65e6006a 100644
--- a/ccan/str/test/compile_fail-isxdigit.c
+++ b/ccan/str/test/compile_fail-isxdigit.c
@@ -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);
diff --git a/tools/configurator/configurator.c b/tools/configurator/configurator.c
index 7b9652be..b78b112f 100644
--- a/tools/configurator/configurator.c
+++ b/tools/configurator/configurator.c
@@ -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,