Skip to content

Commit 33d93d6

Browse files
committed
mingw: uglify pthread_mutex_init definition to shut up warning
When the result of a (a, 0) expression is not used, GCC now 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 <[email protected]>
1 parent f48707f commit 33d93d6

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

compat/nedmalloc/malloc.c.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1804,9 +1804,10 @@ struct win32_mlock_t
18041804
volatile long threadid;
18051805
};
18061806

1807+
static inline int return_0(int i) { return 0; }
18071808
#define MLOCK_T struct win32_mlock_t
18081809
#define CURRENT_THREAD win32_getcurrentthreadid()
1809-
#define INITIAL_LOCK(sl) (memset(sl, 0, sizeof(MLOCK_T)), 0)
1810+
#define INITIAL_LOCK(sl) (memset(sl, 0, sizeof(MLOCK_T)), return_0(0))
18101811
#define ACQUIRE_LOCK(sl) win32_acquire_lock(sl)
18111812
#define RELEASE_LOCK(sl) win32_release_lock(sl)
18121813
#define TRY_LOCK(sl) win32_try_lock(sl)

compat/win32/pthread.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
*/
1919
#define pthread_mutex_t CRITICAL_SECTION
2020

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))
2225
#define pthread_mutex_destroy(a) DeleteCriticalSection((a))
2326
#define pthread_mutex_lock EnterCriticalSection
2427
#define pthread_mutex_unlock LeaveCriticalSection

0 commit comments

Comments
 (0)