mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2024-11-26 23:42:05 +00:00
wasm_runtime_common.c: add assertion for BH_MALLOC/BH_FREE (#1139)
Add assertion for BH_MALLOC/BH_FREE in wasm_runtime_common.c, when building runtime, the BH_MALLOC/BH_FREE macros should be defined as wasm_runtime_malloc/wasm_runtime_free.
This commit is contained in:
parent
16cfd4764d
commit
03f2153270
|
@ -29,6 +29,28 @@
|
|||
#endif
|
||||
#include "../common/wasm_c_api_internal.h"
|
||||
|
||||
/**
|
||||
* For runtime build, BH_MALLOC/BH_FREE should be defined as
|
||||
* wasm_runtime_malloc/wasm_runtime_free.
|
||||
*/
|
||||
#define CHECK(a) CHECK1(a)
|
||||
#define CHECK1(a) SHOULD_BE_##a
|
||||
|
||||
#define SHOULD_BE_wasm_runtime_malloc 1
|
||||
#if !CHECK(BH_MALLOC)
|
||||
#error unexpected BH_MALLOC
|
||||
#endif
|
||||
#undef SHOULD_BE_wasm_runtime_malloc
|
||||
|
||||
#define SHOULD_BE_wasm_runtime_free 1
|
||||
#if !CHECK(BH_FREE)
|
||||
#error unexpected BH_FREE
|
||||
#endif
|
||||
#undef SHOULD_BE_wasm_runtime_free
|
||||
|
||||
#undef CHECK
|
||||
#undef CHECK1
|
||||
|
||||
#if WASM_ENABLE_MULTI_MODULE != 0
|
||||
/**
|
||||
* A safety insurance to prevent
|
||||
|
|
Loading…
Reference in New Issue
Block a user