Skip to content

Commit

Permalink
malloc: modify compiler warning workarounds
Browse files Browse the repository at this point in the history
clang will complain when (in a function like this) we try to silence
"unused" warnings with a self-assignment. It's equivalently useless to
just cast to (void), and I think it will still silence the warning it
was originally trying to silence.
  • Loading branch information
Brian Norris committed Aug 14, 2013
1 parent 130a351 commit 8e70d2b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3834,7 +3834,7 @@ static void* mmap_alloc(mstate m, size_t nb) {
/* Realloc using mmap */
static mchunkptr mmap_resize(mstate m, mchunkptr oldp, size_t nb, int flags) {
size_t oldsize = chunksize(oldp);
flags = flags; /* placate people compiling -Wunused */
(void)flags; /* placate people compiling -Wunused */
if (is_small(nb)) /* Can't shrink mmap regions below small size */
return 0;
/* Keep old chunk if big enough but not too big */
Expand Down Expand Up @@ -5588,7 +5588,7 @@ void mspace_free(mspace msp, void* mem) {
mchunkptr p = mem2chunk(mem);
#if FOOTERS
mstate fm = get_mstate_for(p);
msp = msp; /* placate people compiling -Wunused */
(void)msp; /* placate people compiling -Wunused */
#else /* FOOTERS */
mstate fm = (mstate)msp;
#endif /* FOOTERS */
Expand Down Expand Up @@ -5762,7 +5762,7 @@ void* mspace_realloc_in_place(mspace msp, void* oldmem, size_t bytes) {
mstate m = (mstate)msp;
#else /* FOOTERS */
mstate m = get_mstate_for(oldp);
msp = msp; /* placate people compiling -Wunused */
(void)msp; /* placate people compiling -Wunused */
if (!ok_magic(m)) {
USAGE_ERROR_ACTION(m, oldmem);
return 0;
Expand Down

0 comments on commit 8e70d2b

Please sign in to comment.