summaryrefslogtreecommitdiff
path: root/lib/ccan/str/test/compile_fail-islower.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ccan/str/test/compile_fail-islower.c')
-rw-r--r--lib/ccan/str/test/compile_fail-islower.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/ccan/str/test/compile_fail-islower.c b/lib/ccan/str/test/compile_fail-islower.c
new file mode 100644
index 0000000000..ca3f9907e5
--- /dev/null
+++ b/lib/ccan/str/test/compile_fail-islower.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 islower.
+#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 islower(c);
+}