diff options
author | Andrew Tridgell <tridge@samba.org> | 2006-08-21 01:27:22 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:16:19 -0500 |
commit | f23be49188cec903446bea97261c3ea3774dea28 (patch) | |
tree | b67ef4b91d00d3e650154b05dd53e7d0146ee7a0 /source4/lib/talloc/talloc.h | |
parent | c8064e1f9294ec77b198d55998347c7a962e03e5 (diff) | |
download | samba-f23be49188cec903446bea97261c3ea3774dea28.tar.gz samba-f23be49188cec903446bea97261c3ea3774dea28.tar.bz2 samba-f23be49188cec903446bea97261c3ea3774dea28.zip |
r17645: gcc 4.1.x has started producing "value computed is not used" warnings
in very annoying ways for talloc_steal. This rather strange looking
cpp approach avoids these warnings. It's really a problem in gcc, but
better to do this than put up with the huge flood of warnings.
(This used to be commit 8236a0ac5e80c30e52fccc0ef41a6c808ea43420)
Diffstat (limited to 'source4/lib/talloc/talloc.h')
-rw-r--r-- | source4/lib/talloc/talloc.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/source4/lib/talloc/talloc.h b/source4/lib/talloc/talloc.h index c6d20c820f..b873bdb8aa 100644 --- a/source4/lib/talloc/talloc.h +++ b/source4/lib/talloc/talloc.h @@ -62,10 +62,14 @@ typedef void TALLOC_CTX; _talloc_set_destructor((ptr), (void *)_talloc_destructor_fn); \ } while(0) #define _TALLOC_CHECK_TYPE(type,val) +/* this extremely strange macro is to avoid some braindamaged warning + stupidity in gcc 4.1.x */ +#define talloc_steal(ctx, ptr) ({ __typeof__(ptr) __talloc_steal_ret = (__typeof__(ptr))_talloc_steal((ctx),(ptr)); __talloc_steal_ret; }) #else #define talloc_set_destructor(ptr, function) \ _talloc_set_destructor((ptr), (int (*)(void *))(function)) #define _TALLOC_TYPEOF(ptr) void * +#define talloc_steal(ctx, ptr) (_TALLOC_TYPEOF(ptr))_talloc_steal((ctx),(ptr)) #endif /* useful macros for creating type checked pointers */ @@ -90,7 +94,6 @@ typedef void TALLOC_CTX; #define talloc_get_type(ptr, type) (type *)talloc_check_name(ptr, #type) #define talloc_find_parent_bytype(ptr, type) (type *)talloc_find_parent_byname(ptr, #type) -#define talloc_steal(ctx, ptr) (_TALLOC_TYPEOF(ptr))_talloc_steal((ctx),(ptr)) #if TALLOC_DEPRECATED #define talloc_zero_p(ctx, type) talloc_zero(ctx, type) |