Skip to content

Commit 70597e8

Browse files
rscharfegitster
authored andcommitted
nedmalloc: avoid compiler warning about unused value
Cast the evaluated value of the macro INITIAL_LOCK to void to instruct the compiler that we're not interested in said value nor the following warning: In file included from compat/nedmalloc/nedmalloc.c:63: compat/nedmalloc/malloc.c.h: In function ‘init_user_mstate’: compat/nedmalloc/malloc.c.h:1706:62: error: right-hand operand of comma expression has no effect [-Werror=unused-value] 1706 | #define INITIAL_LOCK(sl) (memset(sl, 0, sizeof(MLOCK_T)), 0) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~ compat/nedmalloc/malloc.c.h:5020:3: note: in expansion of macro ‘INITIAL_LOCK’ 5020 | INITIAL_LOCK(&m->mutex); | ^~~~~~~~~~~~ Signed-off-by: René Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c9b9c09 commit 70597e8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compat/nedmalloc/malloc.c.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3066,7 +3066,7 @@ static int init_mparams(void) {
30663066
#if !ONLY_MSPACES
30673067
/* Set up lock for main malloc area */
30683068
gm->mflags = mparams.default_mflags;
3069-
INITIAL_LOCK(&gm->mutex);
3069+
(void)INITIAL_LOCK(&gm->mutex);
30703070
#endif
30713071

30723072
#if (FOOTERS && !INSECURE)
@@ -5017,7 +5017,7 @@ static mstate init_user_mstate(char* tbase, size_t tsize) {
50175017
mchunkptr msp = align_as_chunk(tbase);
50185018
mstate m = (mstate)(chunk2mem(msp));
50195019
memset(m, 0, msize);
5020-
INITIAL_LOCK(&m->mutex);
5020+
(void)INITIAL_LOCK(&m->mutex);
50215021
msp->head = (msize|PINUSE_BIT|CINUSE_BIT);
50225022
m->seg.base = m->least_addr = tbase;
50235023
m->seg.size = m->footprint = m->max_footprint = tsize;

0 commit comments

Comments
 (0)