Norman James | 6a58a27 | 2015-10-07 14:34:16 -0500 | [diff] [blame] | 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 | }
|