summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tools/wasm-interp.c2
-rw-r--r--src/wasm-config.h.in34
2 files changed, 31 insertions, 5 deletions
diff --git a/src/tools/wasm-interp.c b/src/tools/wasm-interp.c
index 5e99a345..e50772b9 100644
--- a/src/tools/wasm-interp.c
+++ b/src/tools/wasm-interp.c
@@ -531,7 +531,7 @@ static WasmResult read_and_run_spec_json(WasmAllocator* allocator,
WasmStringSlice command_file;
WasmStringSlice command_name;
WasmInterpreterTypedValueVector result_values;
- uint32_t command_line_no;
+ uint32_t command_line_no = 0;
WasmBool has_thread = WASM_FALSE;
uint32_t passed = 0;
uint32_t failed = 0;
diff --git a/src/wasm-config.h.in b/src/wasm-config.h.in
index a376b715..86a892de 100644
--- a/src/wasm-config.h.in
+++ b/src/wasm-config.h.in
@@ -34,6 +34,9 @@
/* Whether ssize_t is defined by stddef.h */
#cmakedefine01 HAVE_SSIZE_T
+/* Whether strcasecmp is defined by strings.h */
+#cmakedefine01 HAVE_STRCASECMP
+
#cmakedefine01 COMPILER_IS_CLANG
#cmakedefine01 COMPILER_IS_GNU
#cmakedefine01 COMPILER_IS_MSVC
@@ -48,6 +51,8 @@
#elif COMPILER_IS_MSVC
#include <malloc.h>
#define alloca _alloca
+#elif __MINGW32__
+#include <malloc.h>
#else
#error no alloca
#endif
@@ -87,10 +92,6 @@
#error "don't know how to define 64-bit builtins"
#endif
-/* print format specifier for size_t */
-#define PRIzd "zd"
-#define PRIzx "zx"
-
#define WABT_UNREACHABLE __builtin_unreachable()
#elif COMPILER_IS_MSVC
@@ -177,6 +178,16 @@ __inline unsigned __int64 __popcnt64(unsigned __int64 value) {
#endif
#define wasm_popcount_u64 __popcnt64
+#else
+
+#error unknown compiler
+
+#endif
+
+
+/* Check For MINGW first, because it is also a GNU compiler */
+#if COMPILER_IS_MSVC || __MINGW32__
+
/* print format specifier for size_t */
#if SIZEOF_SIZE_T == 4
#define PRIzd "d"
@@ -188,12 +199,19 @@ __inline unsigned __int64 __popcnt64(unsigned __int64 value) {
#error "weird sizeof size_t"
#endif
+#elif COMPILER_IS_CLANG || COMPILER_IS_GNU
+
+/* print format specifier for size_t */
+#define PRIzd "zd"
+#define PRIzx "zx"
+
#else
#error unknown compiler
#endif
+
#if HAVE_SNPRINTF
#define wasm_snprintf snprintf
#elif COMPILER_IS_MSVC
@@ -215,4 +233,12 @@ int wasm_vsnprintf(char* str, size_t size, const char* format, va_list ap);
typedef int ssize_t;
#endif
+#if !HAVE_STRCASECMP
+#if COMPILER_IS_MSVC
+#define strcasecmp _stricmp
+#else
+#error no strcasecmp
+#endif
+#endif
+
#endif /* WASM_CONFIG_H_ */