Commit 00e61068 authored by Rusty Russell's avatar Rusty Russell

str: fix tests on unsigned chars, and !HAVE_ISBLANK.

parent 5c922794
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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
}
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment