diff options
-rw-r--r-- | CMakeLists.txt | 19 | ||||
-rw-r--r-- | src/binary-reader-objdump.cc | 4 | ||||
-rw-r--r-- | src/test-literal.cc | 6 |
3 files changed, 17 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b69483f6..cbf34e20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,6 +121,10 @@ configure_file( include_directories(${WABT_SOURCE_DIR} ${WABT_BINARY_DIR}) if (COMPILER_IS_MSVC) + if (WERROR) + add_definitions(-WX) + endif () + # disable warning C4018: signed/unsigned mismatch # disable warning C4056, C4756: overflow in floating-point constant arithmetic # seems to not like float compare w/ HUGE_VALF; bug? @@ -138,6 +142,10 @@ if (COMPILER_IS_MSVC) add_definitions("/MP") else () + if (WERROR) + add_definitions(-Werror) + endif () + # disable -Wunused-parameter: this is really common when implementing # interfaces, etc. # disable -Wpointer-arith: this is a GCC extension, and doesn't work in MSVC. @@ -374,14 +382,8 @@ if (BUILD_LIBWASM) target_link_libraries(wasm wabt) target_include_directories(wasm PUBLIC third_party/wasm-c-api/include) if (COMPILER_IS_MSVC) - if (WERROR) - target_compile_options(wasm PRIVATE -WX) - endif () target_compile_definitions(wasm PRIVATE "WASM_API_EXTERN=__declspec(dllexport)") else () - if (WERROR) - target_compile_options(wasm PRIVATE -Werror) - endif () target_compile_options(wasm PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-Wno-old-style-cast>) target_compile_definitions(wasm PRIVATE "WASM_API_EXTERN=__attribute__((visibility(\"default\")))") endif () @@ -643,9 +645,12 @@ if (BUILD_TESTS) function(c_api_example NAME) set(EXENAME wasm-c-api-${NAME}) add_executable(${EXENAME} third_party/wasm-c-api/example/${NAME}.c) - if (NOT COMPILER_IS_MSVC) + if (COMPILER_IS_MSVC) + set_target_properties(${EXENAME} PROPERTIES COMPILE_FLAGS "-wd4311") + else () set_target_properties(${EXENAME} PROPERTIES COMPILE_FLAGS "-std=gnu11 -Wno-pointer-to-int-cast") endif () + target_link_libraries(${EXENAME} wasm Threads::Threads) add_custom_target(${EXENAME}-copy-to-bin ALL COMMAND ${CMAKE_COMMAND} -E make_directory ${WABT_SOURCE_DIR}/bin diff --git a/src/binary-reader-objdump.cc b/src/binary-reader-objdump.cc index cb682698..0a8b7dc8 100644 --- a/src/binary-reader-objdump.cc +++ b/src/binary-reader-objdump.cc @@ -1576,7 +1576,7 @@ Result BinaryReaderObjdump::OnExport(Index index, Result BinaryReaderObjdump::OnElemSegmentElemExpr_RefNull(Index segment_index, Type type) { - PrintDetails(" - elem[%" PRIzd "] = ref.null %s\n", + PrintDetails(" - elem[%" PRIu64 "] = ref.null %s\n", elem_offset_ + elem_index_, type.GetName().c_str()); elem_index_++; return Result::Ok; @@ -1584,7 +1584,7 @@ Result BinaryReaderObjdump::OnElemSegmentElemExpr_RefNull(Index segment_index, Result BinaryReaderObjdump::OnElemSegmentElemExpr_RefFunc(Index segment_index, Index func_index) { - PrintDetails(" - elem[%" PRIzd "] = func[%" PRIindex "]", + PrintDetails(" - elem[%" PRIu64 "] = func[%" PRIindex "]", elem_offset_ + elem_index_, func_index); auto name = GetFunctionName(func_index); if (!name.empty()) { diff --git a/src/test-literal.cc b/src/test-literal.cc index f1ed6313..57a933a4 100644 --- a/src/test-literal.cc +++ b/src/test-literal.cc @@ -297,7 +297,7 @@ TEST(ParseInt32, Both) { TEST(ParseInt32, SignedAndUnsigned) { AssertInt32Equals(2147483648, "-2147483648", SignedAndUnsigned); - AssertInt32Equals(-0x80000000u, "-0x80000000", SignedAndUnsigned); + AssertInt32Equals(-0x80000000ll, "-0x80000000", SignedAndUnsigned); AssertInt32Equals(4294967295u, "-1", SignedAndUnsigned); AssertInt32Equals(-1, "-0x1", SignedAndUnsigned); AssertInt32Equals(1, "+1", SignedAndUnsigned); @@ -348,9 +348,9 @@ TEST(ParseInt64, SignedAndUnsigned) { AssertInt64Equals(18446744073709551615ull, "-1", SignedAndUnsigned); AssertInt64Equals(-1, "-0x1", SignedAndUnsigned); AssertInt64Equals(1, "+1", SignedAndUnsigned); - AssertInt64Equals(-0x0bcdefabcdefabcdull, "-0x0BCDEFABCDEFABCD", + AssertInt64Equals(-0x0bcdefabcdefabcdll, "-0x0BCDEFABCDEFABCD", SignedAndUnsigned); - AssertInt64Equals(0xabcdefabcdefabcdull, "+0xabcdefabcdefabcd", + AssertInt64Equals(0xabcdefabcdefabcdll, "+0xabcdefabcdefabcd", SignedAndUnsigned); } |