diff options
author | Sebastian Hahn <sebastian@torproject.org> | 2011-11-08 08:09:40 +0100 |
---|---|---|
committer | Sebastian Hahn <sebastian@torproject.org> | 2011-11-09 10:26:35 +0100 |
commit | 0cc7a63fc0f8e23e0dc01a36de9a369671bdd4d5 (patch) | |
tree | 46f03f139ad89adfe1d051f0456d513a326a2e64 /src/common/compat.h | |
parent | 8ba1cf3007fccafa764e8f96e346354dca45f2ed (diff) | |
download | tor-0cc7a63fc0f8e23e0dc01a36de9a369671bdd4d5.tar.gz tor-0cc7a63fc0f8e23e0dc01a36de9a369671bdd4d5.zip |
Don't warn when compiling with --disable-threads
STMT_VOID semantics suggested by nick, thanks!
Diffstat (limited to 'src/common/compat.h')
-rw-r--r-- | src/common/compat.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/common/compat.h b/src/common/compat.h index eb79b04449..7e6058a547 100644 --- a/src/common/compat.h +++ b/src/common/compat.h @@ -177,6 +177,10 @@ extern INLINE double U64_TO_DBL(uint64_t x) { /** Expands to a syntactically valid empty statement. */ #define STMT_NIL (void)0 +/** Expands to a syntactically valid empty statement, explicitly (void)ing its + * argument. */ +#define STMT_VOID(a) while (0) { (void)(a); } + #ifdef __GNUC__ /** STMT_BEGIN and STMT_END are used to wrap blocks inside macros so that * the macro can be used as if it were a single C statement. */ @@ -610,7 +614,7 @@ void tor_threads_init(void); #else #define tor_mutex_new() ((tor_mutex_t*)tor_malloc(sizeof(int))) #define tor_mutex_init(m) STMT_NIL -#define tor_mutex_acquire(m) STMT_NIL +#define tor_mutex_acquire(m) STMT_VOID(m) #define tor_mutex_release(m) STMT_NIL #define tor_mutex_free(m) STMT_BEGIN tor_free(m); STMT_END #define tor_mutex_uninit(m) STMT_NIL |