mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-08 12:46:14 +00:00
Fix build errors when initializing wasm_val_t values with macros (#3007)
Errors were reported when initializing wasm_val_t values with WASM_I32_VAL like macros. ``` error: missing initializer for member ‘wasm_val_t::__paddings’ [-Werror=missing-field-initializers] 64 | wasm_val_t res = {WASM_INIT_VAL}; ``` And rename DEPRECATED to WASM_API_DEPRECATED to avoid using defines with generic names.
This commit is contained in:
parent
08442458b1
commit
63012f0222
|
@ -22,12 +22,12 @@
|
|||
#endif
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#define DEPRECATED __attribute__((deprecated))
|
||||
#define WASM_API_DEPRECATED __attribute__((deprecated))
|
||||
#elif defined(_MSC_VER)
|
||||
#define DEPRECATED __declspec(deprecated)
|
||||
#define WASM_API_DEPRECATED __declspec(deprecated)
|
||||
#else
|
||||
#pragma message("WARNING: You need to implement DEPRECATED for this compiler")
|
||||
#define DEPRECATED
|
||||
#define WASM_API_DEPRECATED
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -231,7 +231,7 @@ WASM_DECLARE_OWN(engine)
|
|||
*/
|
||||
WASM_API_EXTERN own wasm_engine_t* wasm_engine_new(void);
|
||||
WASM_API_EXTERN own wasm_engine_t* wasm_engine_new_with_config(wasm_config_t*);
|
||||
DEPRECATED WASM_API_EXTERN own wasm_engine_t *
|
||||
WASM_API_DEPRECATED WASM_API_EXTERN own wasm_engine_t *
|
||||
wasm_engine_new_with_args(mem_alloc_type_t type, const MemAllocOption *opts);
|
||||
|
||||
// Store
|
||||
|
@ -828,12 +828,12 @@ static inline void* wasm_val_ptr(const wasm_val_t* val) {
|
|||
#endif
|
||||
}
|
||||
|
||||
#define WASM_I32_VAL(i) {.kind = WASM_I32, .of = {.i32 = i}}
|
||||
#define WASM_I64_VAL(i) {.kind = WASM_I64, .of = {.i64 = i}}
|
||||
#define WASM_F32_VAL(z) {.kind = WASM_F32, .of = {.f32 = z}}
|
||||
#define WASM_F64_VAL(z) {.kind = WASM_F64, .of = {.f64 = z}}
|
||||
#define WASM_REF_VAL(r) {.kind = WASM_ANYREF, .of = {.ref = r}}
|
||||
#define WASM_INIT_VAL {.kind = WASM_ANYREF, .of = {.ref = NULL}}
|
||||
#define WASM_I32_VAL(i) {.kind = WASM_I32, .__paddings = {0}, .of = {.i32 = i}}
|
||||
#define WASM_I64_VAL(i) {.kind = WASM_I64, .__paddings = {0}, .of = {.i64 = i}}
|
||||
#define WASM_F32_VAL(z) {.kind = WASM_F32, .__paddings = {0}, .of = {.f32 = z}}
|
||||
#define WASM_F64_VAL(z) {.kind = WASM_F64, .__paddings = {0}, .of = {.f64 = z}}
|
||||
#define WASM_REF_VAL(r) {.kind = WASM_ANYREF, .__paddings = {0}, .of = {.ref = r}}
|
||||
#define WASM_INIT_VAL {.kind = WASM_ANYREF, .__paddings = {0}, .of = {.ref = NULL}}
|
||||
|
||||
#define KILOBYTE(n) ((n) * 1024)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user