]> git.ozlabs.org Git - ccan/blob - ccan/typesafe_cb/test/compile_ok-cast_if_any.c
ccanlint: test for C++ reserved words in headers.
[ccan] / ccan / typesafe_cb / test / compile_ok-cast_if_any.c
1 #include <ccan/typesafe_cb/typesafe_cb.h>
2 #include <stdlib.h>
3
4 struct foo {
5         int x;
6 };
7
8 struct bar {
9         int x;
10 };
11
12 struct baz {
13         int x;
14 };
15
16 struct any {
17         int x;
18 };
19
20 static void take_any(struct any *any)
21 {
22 }
23
24 int main(int argc, char *argv[])
25 {
26 #if HAVE_TYPEOF
27         /* Otherwise we get unused warnings for these. */
28         struct foo *foo = NULL;
29         struct bar *bar = NULL;
30         struct baz *baz = NULL;
31 #endif
32         struct other *arg = NULL;
33
34         take_any(cast_if_any(struct any *, arg, foo,
35                              struct foo *, struct bar *, struct baz *));
36         take_any(cast_if_any(struct any *, arg, bar,
37                              struct foo *, struct bar *, struct baz *));
38         take_any(cast_if_any(struct any *, arg, baz,
39                              struct foo *, struct bar *, struct baz *));
40         return 0;
41 }