Browse Source

array_size: make sure tests work even without GCC features.

In this case, "work" means "fail to compile cleanly".
Rusty Russell 15 years ago
parent
commit
ef54ea44cc
1 changed files with 3 additions and 0 deletions
  1. 3 0
      ccan/array_size/test/compile_fail-function-param.c

+ 3 - 0
ccan/array_size/test/compile_fail-function-param.c

@@ -10,6 +10,9 @@ int check_parameter(const struct foo array[4])
 {
 {
 #ifdef FAIL
 #ifdef FAIL
 	return (ARRAY_SIZE(array) == 4);
 	return (ARRAY_SIZE(array) == 4);
+#if !HAVE_TYPEOF || !HAVE_BUILTIN_TYPES_COMPATIBLE_P
+#error "Unfortunately we don't fail if _array_size_chk is a noop."
+#endif
 #else
 #else
 	return sizeof(array) == 4 * sizeof(struct foo);
 	return sizeof(array) == 4 * sizeof(struct foo);
 #endif
 #endif