Skip to content

Commit 2f0b9df

Browse files
committed
Fix test compilation for Emscripten
1 parent b21d054 commit 2f0b9df

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

tests/memory_tracker.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ std::size_t double_delete = 0u;
1212
bool memory_tracking = false;
1313
bool force_next_allocation_failure = false;
1414

15-
#if defined(CHECK_MEMORY_LEAKS) && CHECK_MEMORY_LEAKS
15+
#if defined(CHECK_MEMORY_LEAKS)
1616
void* allocate(std::size_t size, bool array, std::align_val_t align) {
1717
if (memory_tracking && num_allocations == max_allocations) {
1818
throw std::bad_alloc();
@@ -27,9 +27,9 @@ void* allocate(std::size_t size, bool array, std::align_val_t align) {
2727
if (align == std::align_val_t{0}) {
2828
p = std::malloc(size);
2929
} else {
30-
# if defined(OUP_PLATFORM_WINDOWS)
30+
# if defined(OUP_COMPILER_MSVC)
3131
p = _aligned_malloc(size, static_cast<std::size_t>(align));
32-
# elif defined(OUP_PLATFORM_EMSCRIPTEN)
32+
# elif defined(OUP_COMPILER_EMSCRIPTEN)
3333
p = aligned_alloc(static_cast<std::size_t>(align), size);
3434
# else
3535
p = std::aligned_alloc(static_cast<std::size_t>(align), size);
@@ -83,7 +83,7 @@ void deallocate(void* p, bool array, std::align_val_t align [[maybe_unused]]) {
8383
if (align == std::align_val_t{0}) {
8484
std::free(p);
8585
} else {
86-
# if defined(OUP_PLATFORM_WINDOWS)
86+
# if defined(OUP_COMPILER_MSVC)
8787
_aligned_free(p);
8888
# else
8989
std::free(p);

tests/runtime_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "tests_common.hpp"
2-
#define CHECK_MEMORY_LEAKS 1
2+
#define CHECK_MEMORY_LEAKS
33
#include "memory_tracker.hpp"
44

55
#include <catch2/catch_test_macros.hpp>

tests/size_benchmark.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#define CHECK_MEMORY_LEAKS 1
1+
#define CHECK_MEMORY_LEAKS
22
#include "memory_tracker.hpp"
33

44
#include <iostream>

0 commit comments

Comments
 (0)