summaryrefslogtreecommitdiff
path: root/wasm2c/examples
diff options
context:
space:
mode:
authorShravan Narayan <shravanrn@gmail.com>2023-04-29 15:37:23 -0400
committerShravan Narayan <shravanrn@gmail.com>2023-05-02 14:27:21 -0400
commit5abbeaab97eb802acccf866d9c8cc021c1f7e570 (patch)
tree54380ba2ead12f36b1cf7b16aa2f68d2617fc9ef /wasm2c/examples
parent4d9a1475a744ab78e7fbc3dc60bf7038dad6119d (diff)
downloadwabt-5abbeaab97eb802acccf866d9c8cc021c1f7e570.tar.gz
wabt-5abbeaab97eb802acccf866d9c8cc021c1f7e570.tar.bz2
wabt-5abbeaab97eb802acccf866d9c8cc021c1f7e570.zip
wasm2c: Enable exceptions and simd according to command line flags
Diffstat (limited to 'wasm2c/examples')
-rw-r--r--wasm2c/examples/callback/Makefile2
-rw-r--r--wasm2c/examples/fac/Makefile2
-rw-r--r--wasm2c/examples/fac/fac.c6
-rw-r--r--wasm2c/examples/fac/fac.h4
-rw-r--r--wasm2c/examples/rot13/Makefile2
5 files changed, 12 insertions, 4 deletions
diff --git a/wasm2c/examples/callback/Makefile b/wasm2c/examples/callback/Makefile
index c226ff31..ece54c34 100644
--- a/wasm2c/examples/callback/Makefile
+++ b/wasm2c/examples/callback/Makefile
@@ -14,6 +14,6 @@ callback.wasm: callback.wat ../../../bin/wat2wasm
../../../bin/wat2wasm --debug-names $< -o $@
callback.c: callback.wasm ../../../bin/wasm2c
- ../../../bin/wasm2c $< -o $@
+ ../../../bin/wasm2c $< -o $@ --disable-simd
.PHONY: all clean
diff --git a/wasm2c/examples/fac/Makefile b/wasm2c/examples/fac/Makefile
index a5179a71..623fcfc3 100644
--- a/wasm2c/examples/fac/Makefile
+++ b/wasm2c/examples/fac/Makefile
@@ -12,6 +12,6 @@ fac.wasm: fac.wat ../../../bin/wat2wasm
../../../bin/wat2wasm $< -o $@
fac.c: fac.wasm ../../../bin/wasm2c
- ../../../bin/wasm2c $< -o $@
+ ../../../bin/wasm2c $< -o $@ --disable-simd
.PHONY: all clean
diff --git a/wasm2c/examples/fac/fac.c b/wasm2c/examples/fac/fac.c
index 970abbe1..683c5d80 100644
--- a/wasm2c/examples/fac/fac.c
+++ b/wasm2c/examples/fac/fac.c
@@ -4,10 +4,14 @@
#include <stdarg.h>
#include <stddef.h>
#include <string.h>
-#if defined(_MSC_VER)
+#if defined(__MINGW32__)
+#include <malloc.h>
+#elif defined(_MSC_VER)
#include <intrin.h>
#include <malloc.h>
#define alloca _alloca
+#elif defined(__FreeBSD__) || defined(__OpenBSD__)
+#include <stdlib.h>
#else
#include <alloca.h>
#endif
diff --git a/wasm2c/examples/fac/fac.h b/wasm2c/examples/fac/fac.h
index 5450fe42..f85dc5a9 100644
--- a/wasm2c/examples/fac/fac.h
+++ b/wasm2c/examples/fac/fac.h
@@ -6,6 +6,10 @@
#include "wasm-rt.h"
+#if defined(WASM_RT_ENABLE_EXCEPTION_HANDLING)
+#include "wasm-rt-exceptions.h"
+#endif
+
#if defined(WASM_RT_ENABLE_SIMD)
#include "simde/wasm/simd128.h"
#endif
diff --git a/wasm2c/examples/rot13/Makefile b/wasm2c/examples/rot13/Makefile
index b957c19f..4461af7c 100644
--- a/wasm2c/examples/rot13/Makefile
+++ b/wasm2c/examples/rot13/Makefile
@@ -14,6 +14,6 @@ rot13.wasm: rot13.wat ../../../bin/wat2wasm
../../../bin/wat2wasm $< -o $@
rot13.c: rot13.wasm ../../../bin/wasm2c
- ../../../bin/wasm2c $< -o $@
+ ../../../bin/wasm2c $< -o $@ --disable-simd
.PHONY: all clean