mingw: uglify (a, 0) definitions to shut up warnings
When the result of a (a, 0) expression is not used, MSys2's GCC version finds it necessary to complain with a warning: right-hand operand of comma expression has no effect Let's just pretend to use the 0 value and have a peaceful and quiet life again. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Jan 15, 2016 at 14:24 UTC
2921600afbcdd5f245475602cabba2fbaa5ff93f
2 files changed
+6
-2
compat/nedmalloc/malloc.c.h
+2
-1
@@ -1802,9 +1802,10 @@ struct win32_mlock_t
1802
volatile long threadid;
1803
};
1804
1805
+static inline int return_0(int i) { return 0; }
1806
#define MLOCK_T struct win32_mlock_t
1807
#define CURRENT_THREAD win32_getcurrentthreadid()
1807
-#define INITIAL_LOCK(sl) (memset(sl, 0, sizeof(MLOCK_T)), 0)
1808
+#define INITIAL_LOCK(sl) (memset(sl, 0, sizeof(MLOCK_T)), return_0(0))
1809
#define ACQUIRE_LOCK(sl) win32_acquire_lock(sl)
1810
#define RELEASE_LOCK(sl) win32_release_lock(sl)
1811
#define TRY_LOCK(sl) win32_try_lock(sl)
compat/win32/pthread.h
+4
-1
@@ -18,7 +18,10 @@
18
*/
19
#define pthread_mutex_t CRITICAL_SECTION
20
21
-#define pthread_mutex_init(a,b) (InitializeCriticalSection((a)), 0)
21
+static inline int return_0(int i) {
22
+ return 0;
23
+}
24
+#define pthread_mutex_init(a,b) return_0((InitializeCriticalSection((a)), 0))
25
#define pthread_mutex_destroy(a) DeleteCriticalSection((a))
26
#define pthread_mutex_lock EnterCriticalSection
27
#define pthread_mutex_unlock LeaveCriticalSection