Skip to content

Commit c44929f

Browse files
committed
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ca350d6 commit c44929f

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
@@ -1802,9 +1802,10 @@ struct win32_mlock_t
18021802
volatile long threadid;
18031803
};
18041804

1805+
static inline int return_0(int i) { return 0; }
18051806
#define MLOCK_T struct win32_mlock_t
18061807
#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))
18081809
#define ACQUIRE_LOCK(sl) win32_acquire_lock(sl)
18091810
#define RELEASE_LOCK(sl) win32_release_lock(sl)
18101811
#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)