]> git.ozlabs.org Git - ccan/blob - ccan/array_size/test/compile_fail-function-param.c
tdb2: check PID if we are holding a lock.
[ccan] / ccan / array_size / test / compile_fail-function-param.c
1 #include <ccan/array_size/array_size.h>
2 #include <stdlib.h>
3
4 struct foo {
5         unsigned int a, b;
6 };
7
8 int check_parameter(const struct foo array[4]);
9 int check_parameter(const struct foo array[4])
10 {
11 #ifdef FAIL
12         return (ARRAY_SIZE(array) == 4);
13 #if !HAVE_TYPEOF || !HAVE_BUILTIN_TYPES_COMPATIBLE_P
14 #error "Unfortunately we don't fail if _array_size_chk is a noop."
15 #endif
16 #else
17         return sizeof(array) == 4 * sizeof(struct foo);
18 #endif
19 }
20
21 int main(int argc, char *argv[])
22 {
23         return check_parameter(NULL);
24 }