Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error: unused variable 'result' #184

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

felixf4xu
Copy link

@felixf4xu felixf4xu commented Jun 12, 2024

Hi,

When I build this project (with gcc 14) for this code:

void foonathan::memory::virtual_memory_release(void* pages, std::size_t) noexcept
{
auto result = VirtualFree(pages, 0u, MEM_RELEASE);
FOONATHAN_MEMORY_ASSERT_MSG(result, "cannot release pages");
}

I had this error:

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

it happens when FOONATHAN_MEMORY_DEBUG_ASSERT is not defined and then FOONATHAN_MEMORY_ASSERT_MSG is an empty macro and then result is not used.

This PR is to fix the compiling error.

Fix #183

Signed-off-by: U-CW01\uig08771 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant