]> git.ozlabs.org Git - ccan/blob - ccan/str/test/compile_fail-STR_MAX_CHARS.c
opt: add allocator setting.
[ccan] / ccan / str / test / compile_fail-STR_MAX_CHARS.c
1 #include <ccan/str/str.h>
2
3 struct s {
4         int val;
5 };
6
7 int main(int argc, char *argv[])
8 {
9         struct s
10 #ifdef FAIL
11 #if !HAVE_TYPEOF
12         #error We need typeof to check STR_MAX_CHARS.
13 #endif
14 #else
15         /* A pointer is OK. */
16                 *
17 #endif
18                 val;
19         char str[STR_MAX_CHARS(val)];
20
21         str[0] = '\0';
22         return str[0] ? 0 : 1;
23 }