From: Brian Norris Date: Wed, 14 Aug 2013 05:05:23 +0000 (-0700) Subject: malloc: modify compiler warning workarounds X-Git-Url: http://plrg.eecs.uci.edu/git/?p=cdsspec-compiler.git;a=commitdiff_plain;h=8e70d2b46a3e66a95d13f091f92450a0c05fe54f malloc: modify compiler warning workarounds 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. --- diff --git a/malloc.c b/malloc.c index b7f54b7..7189353 100644 --- a/malloc.c +++ b/malloc.c @@ -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 */ @@ -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 */ @@ -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;