summaryrefslogtreecommitdiff
path: root/lib/ccan/str/test/compile_fail-isspace.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ccan/str/test/compile_fail-isspace.c')
-rw-r--r--lib/ccan/str/test/compile_fail-isspace.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/ccan/str/test/compile_fail-isspace.c b/lib/ccan/str/test/compile_fail-isspace.c
new file mode 100644
index 0000000000..bfee1f89f1
--- /dev/null
+++ b/lib/ccan/str/test/compile_fail-isspace.c
@@ -0,0 +1,22 @@
+#define CCAN_STR_DEBUG 1
+#include <ccan/str/str.h>
+
+int main(int argc, char *argv[])
+{
+#ifdef FAIL
+#if !HAVE_BUILTIN_TYPES_COMPATIBLE_P || !HAVE_TYPEOF
+#error We need typeof to check isspace.
+#endif
+ char
+#else
+ unsigned char
+#endif
+ c = argv[0][0];
+
+#ifdef FAIL
+ /* Fake fail on unsigned char platforms. */
+ BUILD_ASSERT((char)255 < 0);
+#endif
+
+ return isspace(c);
+}