Skip to content

Commit 1e5f206

Browse files
authored
Fix compile warnings on windows platform (#2208)
1 parent 0899638 commit 1e5f206

File tree

7 files changed

+9
-10
lines changed

7 files changed

+9
-10
lines changed

core/iwasm/common/wasm_shared_memory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ wasm_runtime_atomic_wait(WASMModuleInstanceCommon *module, void *address,
384384

385385
/* unit of timeout is nsec, convert it to usec */
386386
timeout_left = (uint64)timeout / 1000;
387-
timeout_1sec = 1e6;
387+
timeout_1sec = (uint64)1e6;
388388

389389
while (1) {
390390
if (timeout < 0) {

core/iwasm/interpreter/wasm_interp_classic.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ local_copysignf(float x, float y)
270270
{
271271
union {
272272
float f;
273-
uint32_t i;
273+
uint32 i;
274274
} ux = { x }, uy = { y };
275275
ux.i &= 0x7fffffff;
276276
ux.i |= uy.i & 0x80000000;
@@ -282,9 +282,9 @@ local_copysign(double x, double y)
282282
{
283283
union {
284284
double f;
285-
uint64_t i;
285+
uint64 i;
286286
} ux = { x }, uy = { y };
287-
ux.i &= -1ULL / 2;
287+
ux.i &= UINT64_MAX / 2;
288288
ux.i |= uy.i & 1ULL << 63;
289289
return ux.f;
290290
}

core/iwasm/interpreter/wasm_interp_fast.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ local_copysignf(float x, float y)
232232
{
233233
union {
234234
float f;
235-
uint32_t i;
235+
uint32 i;
236236
} ux = { x }, uy = { y };
237237
ux.i &= 0x7fffffff;
238238
ux.i |= uy.i & 0x80000000;
@@ -244,9 +244,9 @@ local_copysign(double x, double y)
244244
{
245245
union {
246246
double f;
247-
uint64_t i;
247+
uint64 i;
248248
} ux = { x }, uy = { y };
249-
ux.i &= -1ULL / 2;
249+
ux.i &= UINT64_MAX / 2;
250250
ux.i |= uy.i & 1ULL << 63;
251251
return ux.f;
252252
}

core/iwasm/libraries/lib-pthread/lib_pthread_wrapper.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,6 @@ pthread_create_wrapper(wasm_exec_env_t exec_env,
561561
#if WASM_ENABLE_LIBC_WASI != 0
562562
WASIContext *wasi_ctx;
563563
#endif
564-
CApiFuncImport **new_c_api_func_imports = NULL;
565564

566565
bh_assert(module);
567566
bh_assert(module_inst);

core/shared/platform/windows/platform_internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <malloc.h>
2727
#include <process.h>
2828
#include <winsock2.h>
29+
#include <ws2tcpip.h>
2930
#include <windows.h>
3031
#include <basetsd.h>
3132

core/shared/platform/windows/shared_platform.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set (PLATFORM_SHARED_DIR ${CMAKE_CURRENT_LIST_DIR})
55

66
add_definitions(-DBH_PLATFORM_WINDOWS)
77
add_definitions(-DHAVE_STRUCT_TIMESPEC)
8-
8+
add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS)
99

1010
include_directories(${PLATFORM_SHARED_DIR})
1111
include_directories(${PLATFORM_SHARED_DIR}/../include)

product-mini/platforms/windows/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
102102
add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
103103

104104
#set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWIN32_LEAN_AND_MEAN")
105-
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_WINSOCK_DEPRECATED_NO_WARNINGS")
106105
if (NOT MINGW)
107106
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO")
108107
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")

0 commit comments

Comments
 (0)