summaryrefslogtreecommitdiff
path: root/src/c-writer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/c-writer.cc')
-rw-r--r--src/c-writer.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/c-writer.cc b/src/c-writer.cc
index 994f6111..798f85f9 100644
--- a/src/c-writer.cc
+++ b/src/c-writer.cc
@@ -368,6 +368,7 @@ class CWriter {
const std::string&);
void WriteCallIndirectFuncDeclaration(const FuncDeclaration&,
const std::string&);
+ void WriteFeatureMacros();
void WriteModuleInstance();
void WriteGlobals();
void WriteGlobal(const Global&, const std::string&);
@@ -1789,6 +1790,15 @@ void CWriter::WriteCallIndirectFuncDeclaration(const FuncDeclaration& decl,
Write(")");
}
+void CWriter::WriteFeatureMacros() {
+ if (options_.features->exceptions_enabled()) {
+ Write("#define WASM_RT_ENABLE_EXCEPTION_HANDLING", Newline(), Newline());
+ }
+ if (options_.features->simd_enabled()) {
+ Write("#define WASM_RT_ENABLE_SIMD", Newline(), Newline());
+ }
+}
+
void CWriter::WriteModuleInstance() {
BeginInstance();
WriteGlobals();
@@ -5122,6 +5132,7 @@ void CWriter::WriteCHeader() {
Write("#ifndef ", guard, Newline());
Write("#define ", guard, Newline());
Write(Newline());
+ WriteFeatureMacros();
Write(s_header_top);
Write(Newline());
WriteModuleInstance();