Skip to content

compiler error ( from warning) when compiled with FOONATHAN_MEMORY_DEBUG_ASSERT and FOONATHAN_MEMORY_ASSERT not defined  #183

@felixf4xu

Description

@felixf4xu

Hi,

When compiled with the default settings, neither FOONATHAN_MEMORY_DEBUG_ASSERT or FOONATHAN_MEMORY_ASSERT is defined.

so this line

#define FOONATHAN_MEMORY_ASSERT_MSG(Expr, Msg)

will be evaluated to empty code and then

auto result = VirtualFree(pages, 0u, MEM_RELEASE);
FOONATHAN_MEMORY_ASSERT_MSG(result, "cannot release pages");

will have a compiling error (originally warning):

src/foo_mem-ext/src/virtual_memory.cpp: In function 'void foonathan::memory::virtual_memory_release(void*, std::size_t)':
src/foo_mem-ext/src/virtual_memory.cpp:50:10: error: unused variable 'result' [-Werror=unused-variable]
50 | auto result = VirtualFree(pages, 0u, MEM_RELEASE);
| ^~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions