aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2022-12-01 01:01:34 -0600
committerluigi1111 <luigi1111w@gmail.com>2022-12-01 01:01:34 -0600
commit12489c69cbd91a133c9d9137009fbc1b04baa4fb (patch)
treeb5ef6e571490788cd26dca4745cbb1976402d2ae
parentMerge pull request #8503 (diff)
parentunit_tests: suppress memwipe unit warning (diff)
downloadmonero-12489c69cbd91a133c9d9137009fbc1b04baa4fb.tar.xz
Merge pull request #8572
50b7492 unit_tests: suppress memwipe unit warning (Jeffrey Ryan)
-rw-r--r--tests/unit_tests/memwipe.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/unit_tests/memwipe.cpp b/tests/unit_tests/memwipe.cpp
index 97f003471..8eab69548 100644
--- a/tests/unit_tests/memwipe.cpp
+++ b/tests/unit_tests/memwipe.cpp
@@ -31,6 +31,7 @@
#include <stdint.h>
#include "misc_log_ex.h"
#include "memwipe.h"
+#include "warnings.h"
// Probably won't catch the optimized out case, but at least we test
// it works in the normal case
@@ -44,12 +45,15 @@ static void test(bool wipe)
ASSERT_EQ(foo, bar);
free(foo);
char *quux = (char*)malloc(4); // same size, just after free, so we're likely to get the same, depending on the allocator
+PUSH_WARNINGS
+DISABLE_GCC_WARNING(maybe-uninitialized)
if ((intptr_t)quux == foop)
{
MDEBUG(std::hex << std::setw(8) << std::setfill('0') << *(uint32_t*)quux);
if (wipe) { ASSERT_TRUE(memcmp(quux, "bar", 3)); }
}
else MWARNING("We did not get the same location, cannot check");
+POP_WARNINGS
free(quux);
}