diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2011-08-31 13:57:14 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2011-08-31 13:57:14 +0930 |
commit | b88e0c40b777480e101a7524697656d6a03fb563 (patch) | |
tree | eaec73435c2356a4e001d331a2a1aff31b8628a4 /lib/ccan | |
parent | b10ad70f8fd5ee359b4409b373ba93ff050c82d4 (diff) | |
download | samba-b88e0c40b777480e101a7524697656d6a03fb563.tar.gz samba-b88e0c40b777480e101a7524697656d6a03fb563.tar.bz2 samba-b88e0c40b777480e101a7524697656d6a03fb563.zip |
ccan: fix likely redefinition warnings with --enable-tdb2
When we do --enable-tdb2, we start clashing with the replace.h
version:
In file included from ../lib/tdb2/tools/../private.h:25:0,
from ../lib/tdb2/tools/tdb2torture.c:60:
../lib/ccan/likely/likely.h:32:0: warning: "likely" redefined
../lib/replace/replace.h:762:0: note: this is the location of the previous definition
../lib/ccan/likely/likely.h:53:0: warning: "unlikely" redefined
../lib/replace/replace.h:765:0: note: this is the location of the previous definition
I don't like to #ifndef-protect them in general, since you don't want
different parts of the code to silently have different definitions,
but it's the simplest fix for now.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/ccan')
-rw-r--r-- | lib/ccan/likely/likely.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/ccan/likely/likely.h b/lib/ccan/likely/likely.h index c43d276759..3a9c6d4640 100644 --- a/lib/ccan/likely/likely.h +++ b/lib/ccan/likely/likely.h @@ -30,7 +30,9 @@ * return false; * } */ +#ifndef likely #define likely(cond) __builtin_expect(!!(cond), 1) +#endif /** * unlikely - indicate that a condition is unlikely to be true. @@ -51,11 +53,17 @@ * fprintf(stderr, "Overflow!"); * } */ +#ifndef unlikely #define unlikely(cond) __builtin_expect(!!(cond), 0) +#endif #else +#ifndef likely #define likely(cond) (!!(cond)) +#endif +#ifndef unlikely #define unlikely(cond) (!!(cond)) #endif +#endif #else /* CCAN_LIKELY_DEBUG versions */ #define likely(cond) \ (_likely_trace(!!(cond), 1, stringify(cond), __FILE__, __LINE__)) |