From 52013a99efa921eea5de92e46d82ca7f989fc22d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Tue, 18 Apr 2023 23:12:33 +0200 Subject: [PATCH] Fixes #225 ("variable set but not used in dlmalloc_ext_2_8_6.c") --- doc/container.qbk | 1 + src/dlmalloc_2_8_6.c | 1 + src/dlmalloc_ext_2_8_6.c | 2 -- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/container.qbk b/doc/container.qbk index 0e70514..4aa4e86 100644 --- a/doc/container.qbk +++ b/doc/container.qbk @@ -1414,6 +1414,7 @@ use [*Boost.Container]? There are several reasons for that: * Disabled forceinline for Clang due to code bloat issues, see [@https://lists.boost.org/boost-users/2023/04/91445.php Boost mailing list report] * Fixed bugs/issues: + * [@https://github.com/boostorg/container/issues/225 GitHub #225: ['"variable set but not used in dlmalloc_ext_2_8_6.c"]]. * [@https://github.com/boostorg/container/issues/242 GitHub #242: ['"Issue with string::rfind"]]. [endsect] diff --git a/src/dlmalloc_2_8_6.c b/src/dlmalloc_2_8_6.c index 9aa1e5a..d117229 100644 --- a/src/dlmalloc_2_8_6.c +++ b/src/dlmalloc_2_8_6.c @@ -4013,6 +4013,7 @@ static void add_segment(mstate m, char* tbase, size_t tsize, flag_t mmapped) { break; } assert(nfences >= 2); + (void) nfences; //Added by iG to silence warning about unused nfences /* Insert the rest of old top into a bin as an ordinary free chunk */ if (csp != old_top) { diff --git a/src/dlmalloc_ext_2_8_6.c b/src/dlmalloc_ext_2_8_6.c index 2bdd3af..778dd88 100644 --- a/src/dlmalloc_ext_2_8_6.c +++ b/src/dlmalloc_ext_2_8_6.c @@ -1224,14 +1224,12 @@ size_t boost_cont_allocated_memory() if (is_initialized(m)) { size_t nfree = SIZE_T_ONE; /* top always free */ size_t mfree = m->topsize + TOP_FOOT_SIZE; - size_t sum = mfree; msegmentptr s = &m->seg; while (s != 0) { mchunkptr q = align_as_chunk(s->base); while (segment_holds(s, q) && q != m->top && q->head != FENCEPOST_HEAD) { size_t sz = chunksize(q); - sum += sz; if (!is_inuse(q)) { mfree += sz; ++nfree;