]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Don't warn when compiling with --disable-threads
authorSebastian Hahn <sebastian@torproject.org>
Tue, 8 Nov 2011 07:09:40 +0000 (08:09 +0100)
committerSebastian Hahn <sebastian@torproject.org>
Wed, 9 Nov 2011 09:26:35 +0000 (10:26 +0100)
STMT_VOID semantics suggested by nick, thanks!

changes/bug4437 [new file with mode: 0644]
src/common/compat.h

diff --git a/changes/bug4437 b/changes/bug4437
new file mode 100644 (file)
index 0000000..985c670
--- /dev/null
@@ -0,0 +1,5 @@
+  o Minor bugfixes:
+    - Don't warn about unused log_mutex in log.c when building with
+      --disable-threads using a recent GCC. Fixes bug 4437; bugfix on
+      0.1.0.6-rc which introduced --disable-threads.
+
index eb79b044494ff974563666e3f275cc387e90772a..7e6058a54739e74343453dd647afa7ea2f0e31a6 100644 (file)
@@ -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