X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fstr%2Ftest%2Fcompile_fail-isblank.c;fp=ccan%2Fstr%2Ftest%2Fcompile_fail-isblank.c;h=86a33503dab00fb0f3007f4c5c066030ad602c22;hp=0000000000000000000000000000000000000000;hb=ecea073699c60fd5aab9e3955f59a7042d637b68;hpb=3f4e83d8ac847d6bf0c20e88cdbca535e842a97b diff --git a/ccan/str/test/compile_fail-isblank.c b/ccan/str/test/compile_fail-isblank.c new file mode 100644 index 00000000..86a33503 --- /dev/null +++ b/ccan/str/test/compile_fail-isblank.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 isblank. +#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 isblank(c); +}