projects
/
ccan
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5c92279
)
str: fix tests on unsigned chars, and !HAVE_ISBLANK.
author
Rusty Russell
<rusty@rustcorp.com.au>
Wed, 27 Apr 2011 06:35:43 +0000
(16:05 +0930)
committer
Rusty 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
patch
|
blob
|
history
ccan/str/test/compile_fail-isalpha.c
patch
|
blob
|
history
ccan/str/test/compile_fail-isascii.c
patch
|
blob
|
history
ccan/str/test/compile_fail-isblank.c
patch
|
blob
|
history
ccan/str/test/compile_fail-iscntrl.c
patch
|
blob
|
history
ccan/str/test/compile_fail-isdigit.c
patch
|
blob
|
history
ccan/str/test/compile_fail-islower.c
patch
|
blob
|
history
ccan/str/test/compile_fail-isprint.c
patch
|
blob
|
history
ccan/str/test/compile_fail-ispunct.c
patch
|
blob
|
history
ccan/str/test/compile_fail-isspace.c
patch
|
blob
|
history
ccan/str/test/compile_fail-isupper.c
patch
|
blob
|
history
ccan/str/test/compile_fail-isxdigit.c
patch
|
blob
|
history
tools/configurator/configurator.c
patch
|
blob
|
history
diff --git
a/ccan/str/test/compile_fail-isalnum.c
b/ccan/str/test/compile_fail-isalnum.c
index 1b6a3633bdd3234e15b0352d0efd789e551c3632..930defffa0c231862679e42ddb851655cf5a93a1 100644
(file)
--- 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. */
#ifdef FAIL
/* Fake fail on unsigned char platforms. */
- c = 255;
- BUILD_ASSERT(c < 0);
+ BUILD_ASSERT((char)255 < 0);
#endif
return isalnum(c);
#endif
return isalnum(c);
diff --git
a/ccan/str/test/compile_fail-isalpha.c
b/ccan/str/test/compile_fail-isalpha.c
index 76de15041ce537a876ce8bd15c32a07b5e33af02..2005109829be36e1ea558e287b770d9fbb1cc663 100644
(file)
--- 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. */
#ifdef FAIL
/* Fake fail on unsigned char platforms. */
- c = 255;
- BUILD_ASSERT(c < 0);
+ BUILD_ASSERT((char)255 < 0);
#endif
return isalpha(c);
#endif
return isalpha(c);
diff --git
a/ccan/str/test/compile_fail-isascii.c
b/ccan/str/test/compile_fail-isascii.c
index af6e64d5d2653cc68a3f365cbdb53077a97f39d8..ee55e4997434c5cd4c11c01a0bd45d28af67d37d 100644
(file)
--- 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. */
#ifdef FAIL
/* Fake fail on unsigned char platforms. */
- c = 255;
- BUILD_ASSERT(c < 0);
+ BUILD_ASSERT((char)255 < 0);
#endif
return isascii(c);
#endif
return isascii(c);
diff --git
a/ccan/str/test/compile_fail-isblank.c
b/ccan/str/test/compile_fail-isblank.c
index 86a33503dab00fb0f3007f4c5c066030ad602c22..f4cb961d740d9dd0bc9b99825a3af51d3d50d848 100644
(file)
--- 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
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
#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. */
#ifdef FAIL
/* Fake fail on unsigned char platforms. */
- c = 255;
- BUILD_ASSERT(c < 0);
+ BUILD_ASSERT((char)255 < 0);
#endif
#endif
+#if HAVE_ISBLANK
return isblank(c);
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 5ae783b126a4b6d989bee3a16290203dc7f59f08..bc74146542f1b36ecefe1fb394bfb84254d4b571 100644
(file)
--- 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. */
#ifdef FAIL
/* Fake fail on unsigned char platforms. */
- c = 255;
- BUILD_ASSERT(c < 0);
+ BUILD_ASSERT((char)255 < 0);
#endif
return iscntrl(c);
#endif
return iscntrl(c);
diff --git
a/ccan/str/test/compile_fail-isdigit.c
b/ccan/str/test/compile_fail-isdigit.c
index 68d81ba4fcd67b8987198316d691639e609a55c4..71d1c714330f2cf9f363e46a3161a4e0f5c9e93c 100644
(file)
--- 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. */
#ifdef FAIL
/* Fake fail on unsigned char platforms. */
- c = 255;
- BUILD_ASSERT(c < 0);
+ BUILD_ASSERT((char)255 < 0);
#endif
return isdigit(c);
#endif
return isdigit(c);
diff --git
a/ccan/str/test/compile_fail-islower.c
b/ccan/str/test/compile_fail-islower.c
index 9dec95f69a0881cbe530a62c4e2abac849fda6d5..ca3f9907e52087eefb75d6f40831f11c50b12e8e 100644
(file)
--- 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. */
#ifdef FAIL
/* Fake fail on unsigned char platforms. */
- c = 255;
- BUILD_ASSERT(c < 0);
+ BUILD_ASSERT((char)255 < 0);
#endif
return islower(c);
#endif
return islower(c);
diff --git
a/ccan/str/test/compile_fail-isprint.c
b/ccan/str/test/compile_fail-isprint.c
index 30f7639c42ea3704a67ded1fb5ec207a9ca7ba92..6432e41d2b7db9db5ddc0ecd35611fcc169e49d3 100644
(file)
--- 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. */
#ifdef FAIL
/* Fake fail on unsigned char platforms. */
- c = 255;
- BUILD_ASSERT(c < 0);
+ BUILD_ASSERT((char)255 < 0);
#endif
return isprint(c);
#endif
return isprint(c);
diff --git
a/ccan/str/test/compile_fail-ispunct.c
b/ccan/str/test/compile_fail-ispunct.c
index f1ae13ac6da3f04ee4be37e0ecd799e05320e5de..5d941fcba687a23863780acc6076479ba05bfcd8 100644
(file)
--- 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. */
#ifdef FAIL
/* Fake fail on unsigned char platforms. */
- c = 255;
- BUILD_ASSERT(c < 0);
+ BUILD_ASSERT((char)255 < 0);
#endif
return ispunct(c);
#endif
return ispunct(c);
diff --git
a/ccan/str/test/compile_fail-isspace.c
b/ccan/str/test/compile_fail-isspace.c
index c94c49e4893cc506c30df90bf4f217b7c593f50d..bfee1f89f166614b603b9aec5c2315ad430a3af0 100644
(file)
--- 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. */
#ifdef FAIL
/* Fake fail on unsigned char platforms. */
- c = 255;
- BUILD_ASSERT(c < 0);
+ BUILD_ASSERT((char)255 < 0);
#endif
return isspace(c);
#endif
return isspace(c);
diff --git
a/ccan/str/test/compile_fail-isupper.c
b/ccan/str/test/compile_fail-isupper.c
index f23dd659c70ac9fee3b3d2846f2a1891a2c08ea7..4cf9fd35785c37e40e1ea16529845886896381f8 100644
(file)
--- 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. */
#ifdef FAIL
/* Fake fail on unsigned char platforms. */
- c = 255;
- BUILD_ASSERT(c < 0);
+ BUILD_ASSERT((char)255 < 0);
#endif
return isupper(c);
#endif
return isupper(c);
diff --git
a/ccan/str/test/compile_fail-isxdigit.c
b/ccan/str/test/compile_fail-isxdigit.c
index 6a7377fd6d16862a7efad1b90a9b2bbd5c80123f..65e6006a885b029ae7cec620a44aebd652567e22 100644
(file)
--- 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. */
#ifdef FAIL
/* Fake fail on unsigned char platforms. */
- c = 255;
- BUILD_ASSERT(c < 0);
+ BUILD_ASSERT((char)255 < 0);
#endif
return isxdigit(c);
#endif
return isxdigit(c);
diff --git
a/tools/configurator/configurator.c
b/tools/configurator/configurator.c
index 7b9652be90ef096045ce1545f84b9c1afa5b05ec..b78b112f4a9f0b523de52a4b212bc12b17fa9fad 100644
(file)
--- 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,
"#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,
"#include <ctype.h>\n"
"static int func(void) { return isblank(' '); }" },
{ "HAVE_LITTLE_ENDIAN", INSIDE_MAIN|EXECUTE, NULL,