From 6535bdee664f3cec63098188928fe17e951b898b Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 16 Dec 2010 16:03:41 +1030 Subject: [PATCH] typesafe_cb: Fix warnings with gcc-4.5: MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Test compiled with warnings: /home/rusty/devel/cvs/ccan/ccan/typesafe_cb/test/compile_ok-typesafe_cb-NULL.c:/home/rusty/devel/cvs/ccan/ccan/typesafe_cb/test/compile_ok-typesafe_cb-NULL.c: In function ‘main’: /home/rusty/devel/cvs/ccan/ccan/typesafe_cb/test/compile_ok-typesafe_cb-NULL.c:18:2: warning: taking address of expression of type ‘void’ /home/rusty/devel/cvs/ccan/ccan/typesafe_cb/test/compile_ok-typesafe_cb-NULL.c:18:2: warning: taking address of expression of type ‘void’ /home/rusty/devel/cvs/ccan/ccan/typesafe_cb/test/compile_ok-typesafe_cb-NULL.c:18:2: warning: taking address of expression of type ‘void’ /home/rusty/devel/cvs/ccan/ccan/typesafe_cb/test/compile_ok-typesafe_cb-NULL.c:18:2: warning: taking address of expression of type ‘void’ /home/rusty/devel/cvs/ccan/ccan/typesafe_cb/test/compile_ok-typesafe_cb-NULL.c:18:2: warning: taking address of expression of type ‘void’ /home/rusty/devel/cvs/ccan/ccan/typesafe_cb/test/compile_ok-typesafe_cb-NULL.c:18:2: warning: taking address of expression of type ‘void’ /home/rusty/devel/cvs/ccan/ccan/typesafe_cb/test/compile_ok-typesafe_cb-NULL.c:18:2: warning: taking address of expression of type ‘void’ /home/rusty/devel/cvs/ccan/ccan/typesafe_cb/test/compile_ok-typesafe_cb-NULL.c:19:2: warning: taking address of expression of type ‘void’ --- ccan/typesafe_cb/typesafe_cb.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ccan/typesafe_cb/typesafe_cb.h b/ccan/typesafe_cb/typesafe_cb.h index e48741a9..7347b7b2 100644 --- a/ccan/typesafe_cb/typesafe_cb.h +++ b/ccan/typesafe_cb/typesafe_cb.h @@ -107,7 +107,7 @@ * _register_callback(typesafe_cb_def(void, (fn), (arg)), (arg)) */ #define typesafe_cb_def(rtype, fn, arg) \ - cast_if_any(rtype (*)(void *), (fn), &*(fn), \ + cast_if_any(rtype (*)(void *), (fn), (fn)+0, \ rtype (*)(typeof(*arg)*), \ rtype (*)(const typeof(*arg)*), \ rtype (*)(volatile typeof(*arg)*)) @@ -127,7 +127,7 @@ * _register_callback(typesafe_cb_exact(void, (fn), (arg)), (arg)) */ #define typesafe_cb_exact(rtype, fn, arg) \ - cast_if_type(rtype (*)(void *), (fn), &*(fn), rtype (*)(typeof(arg))) + cast_if_type(rtype (*)(void *), (fn), (fn)+0, rtype (*)(typeof(arg))) /** * typesafe_cb_const - cast a const callback function if it matches the arg @@ -166,7 +166,7 @@ * (arg)) */ #define typesafe_cb_preargs(rtype, fn, arg, ...) \ - cast_if_type(rtype (*)(__VA_ARGS__, void *), (fn), &*(fn), \ + cast_if_type(rtype (*)(__VA_ARGS__, void *), (fn), (fn)+0, \ rtype (*)(__VA_ARGS__, typeof(arg))) /** @@ -185,7 +185,7 @@ * (arg)) */ #define typesafe_cb_postargs(rtype, fn, arg, ...) \ - cast_if_type(rtype (*)(void *, __VA_ARGS__), (fn), &*(fn), \ + cast_if_type(rtype (*)(void *, __VA_ARGS__), (fn), (fn)+0, \ rtype (*)(typeof(arg), __VA_ARGS__)) /** @@ -210,7 +210,7 @@ * typesafe_cb_cmp(int, (cmpfn), (base)), (arg)) */ #define typesafe_cb_cmp(rtype, cmpfn, arg) \ - cast_if_type(rtype (*)(const void *, const void *), (cmpfn), &*(cmpfn), \ + cast_if_type(rtype (*)(const void *, const void *), (cmpfn), (cmpfn)+0, \ rtype (*)(const typeof(*arg)*, const typeof(*arg)*)) #endif /* CCAN_CAST_IF_TYPE_H */ -- 2.39.2