X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fstr%2Ftest%2Fcompile_fail-islower.c;fp=ccan%2Fstr%2Ftest%2Fcompile_fail-islower.c;h=9dec95f69a0881cbe530a62c4e2abac849fda6d5;hb=ecea073699c60fd5aab9e3955f59a7042d637b68;hp=0000000000000000000000000000000000000000;hpb=3f4e83d8ac847d6bf0c20e88cdbca535e842a97b;p=ccan diff --git a/ccan/str/test/compile_fail-islower.c b/ccan/str/test/compile_fail-islower.c new file mode 100644 index 00000000..9dec95f6 --- /dev/null +++ b/ccan/str/test/compile_fail-islower.c @@ -0,0 +1,23 @@ +#define CCAN_STR_DEBUG 1 +#include + +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. */ + c = 255; + BUILD_ASSERT(c < 0); +#endif + + return islower(c); +}