Fix clang compile warnings (#3396)

This commit is contained in:
Benbuck Nason 2024-05-08 01:43:47 -07:00 committed by GitHub
parent 07eae7c424
commit 432a940735
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 24 additions and 9 deletions

View File

@ -6,6 +6,11 @@
#include "../wasm_runtime_common.h"
#include "../wasm_exec_env.h"
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-non-prototype"
#endif
void
invokeNative(void (*native_code)(), uint32 argv[], uint32 argc)
{
@ -112,3 +117,7 @@ invokeNative(void (*native_code)(), uint32 argv[], uint32 argc)
}
}
}
#if defined(__clang__)
#pragma clang diagnostic pop
#endif

View File

@ -433,7 +433,7 @@ struct wasm_ref_t;
typedef struct wasm_val_t {
wasm_valkind_t kind;
uint8_t __paddings[7];
uint8_t _paddings[7];
union {
int32_t i32;
int64_t i64;
@ -864,12 +864,12 @@ static inline void* wasm_val_ptr(const wasm_val_t* val) {
#endif
}
#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 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)

View File

@ -255,7 +255,7 @@ struct wasm_ref_t;
typedef struct wasm_val_t {
wasm_valkind_t kind;
uint8_t __paddings[7];
uint8_t _paddings[7];
union {
/* also represent a function index */
int32_t i32;

View File

@ -112,7 +112,7 @@ struct WASMMemoryInstance {
/* Four-byte paddings to ensure the layout of WASMMemoryInstance is the same
* in both 64-bit and 32-bit */
uint8 __paddings[4];
uint8 _paddings[4];
/* Number bytes per page */
uint32 num_bytes_per_page;

View File

@ -70,7 +70,10 @@ typedef enum {
GC_STAT_MAX
} GC_STAT_INDEX;
#ifndef GC_FINALIZER_T_DEFINED
#define GC_FINALIZER_T_DEFINED
typedef void (*gc_finalizer_t)(void *obj, void *data);
#endif
#ifndef EXTRA_INFO_NORMAL_NODE_CNT
#define EXTRA_INFO_NORMAL_NODE_CNT 32

View File

@ -17,7 +17,10 @@ extern "C" {
typedef void *mem_allocator_t;
#ifndef GC_FINALIZER_T_DEFINED
#define GC_FINALIZER_T_DEFINED
typedef void (*gc_finalizer_t)(void *obj, void *data);
#endif
mem_allocator_t
mem_allocator_create(void *mem, uint32_t size);