Fix unused variable and wrong warning workaround
I had been looking at the wrong line all along when attempting to fix: ``` core/os/memory.cpp:184:13: warning: unused variable 's' [-Wunused-variable] uint64_t *s = (uint64_t *)mem; ^ ```
This commit is contained in:
parent
181af9b484
commit
f5532bb650
1 changed files with 1 additions and 10 deletions
|
@ -89,17 +89,8 @@ void *Memory::alloc_static(size_t p_bytes, bool p_pad_align) {
|
|||
atomic_increment(&alloc_count);
|
||||
|
||||
if (prepad) {
|
||||
// Clang 5 wrongly complains about 's' being unused,
|
||||
// while it's used to modify 'mem'.
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-variable"
|
||||
#endif // __clang__
|
||||
uint64_t *s = (uint64_t *)mem;
|
||||
*s = p_bytes;
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif // __clang__
|
||||
|
||||
uint8_t *s8 = (uint8_t *)mem;
|
||||
|
||||
|
@ -181,9 +172,9 @@ void Memory::free_static(void *p_ptr, bool p_pad_align) {
|
|||
|
||||
if (prepad) {
|
||||
mem -= PAD_ALIGN;
|
||||
uint64_t *s = (uint64_t *)mem;
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
uint64_t *s = (uint64_t *)mem;
|
||||
atomic_sub(&mem_usage, *s);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue