Commit 63f2e96eea

Shritesh Bhattarai <shritesh@shritesh.com>
2019-04-12 17:54:15
wasm: use .wasm ext for exe
1 parent 6284a4c
Changed files (3)
src/codegen.cpp
@@ -7953,8 +7953,7 @@ static void init(CodeGen *g) {
         }
     }
 
-    bool is_wasm = g->zig_target->arch == ZigLLVM_wasm32 || g->zig_target->arch == ZigLLVM_wasm64;
-    g->have_err_ret_tracing = !is_wasm && g->build_mode != BuildModeFastRelease && g->build_mode != BuildModeSmallRelease;
+    g->have_err_ret_tracing = !target_is_wasm(g->zig_target) && g->build_mode != BuildModeFastRelease && g->build_mode != BuildModeSmallRelease;
 
     define_builtin_fns(g);
     Error err;
src/target.cpp
@@ -965,6 +965,8 @@ const char *target_exe_file_ext(const ZigTarget *target) {
         return ".exe";
     } else if (target->os == OsUefi) {
         return ".efi";
+    } else if (target_is_wasm(target)) {
+        return ".wasm";
     } else {
         return "";
     }
@@ -1365,6 +1367,10 @@ bool target_is_musl(const ZigTarget *target) {
     return target->os == OsLinux && target_abi_is_musl(target->abi);
 }
 
+bool target_is_wasm(const ZigTarget *target) {
+    return target->arch == ZigLLVM_wasm32 || target->arch == ZigLLVM_wasm64;
+}
+
 ZigLLVM_EnvironmentType target_default_abi(ZigLLVM_ArchType arch, Os os) {
     switch (os) {
         case OsFreestanding:
src/target.hpp
@@ -170,6 +170,7 @@ bool target_abi_is_gnu(ZigLLVM_EnvironmentType abi);
 bool target_abi_is_musl(ZigLLVM_EnvironmentType abi);
 bool target_is_glibc(const ZigTarget *target);
 bool target_is_musl(const ZigTarget *target);
+bool target_is_wasm(const ZigTarget *target);
 
 uint32_t target_arch_pointer_bit_width(ZigLLVM_ArchType arch);