From 754c677b0bbf3ea6c7d2a73c93848f1b0d68c91e Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 20 Jun 2011 16:54:15 +0930 Subject: lib: import ccan modules for tdb2 Imported from git://git.ozlabs.org/~ccan/ccan init-1161-g661d41f Signed-off-by: Rusty Russell --- .../asearch/test/compile_fail-return-value-const.c | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 lib/ccan/asearch/test/compile_fail-return-value-const.c (limited to 'lib/ccan/asearch/test/compile_fail-return-value-const.c') diff --git a/lib/ccan/asearch/test/compile_fail-return-value-const.c b/lib/ccan/asearch/test/compile_fail-return-value-const.c new file mode 100644 index 0000000000..2edee93501 --- /dev/null +++ b/lib/ccan/asearch/test/compile_fail-return-value-const.c @@ -0,0 +1,25 @@ +#include +#include +#include + +static int cmp(const char *key, const char *const *elem) +{ + return strcmp(key, *elem); +} + +int main(void) +{ + const char key[] = "key"; + const char *elems[] = { "a", "big", "list", "of", "things" }; + +#ifdef FAIL + char **p; +#if !HAVE_TYPEOF +#error "Unfortunately we don't fail if no typeof." +#endif +#else + const char **p; +#endif + p = asearch(key, elems, ARRAY_SIZE(elems), cmp); + return p ? 0 : 1; +} -- cgit