Coverage Report

Created: 2026-08-14 06:41

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/WasmEdge/include/driver/options.h
Line
Count
Source
1
// SPDX-License-Identifier: Apache-2.0
2
// SPDX-FileCopyrightText: Copyright The WasmEdge Authors
3
4
//===-- wasmedge/driver/options.h - Shared option definitions -------------===//
5
//
6
// Part of the WasmEdge Project.
7
//
8
//===----------------------------------------------------------------------===//
9
///
10
/// \file
11
/// This file contains the shared proposal options base struct used by both
12
/// the runtime tool and the compiler tool.
13
///
14
//===----------------------------------------------------------------------===//
15
#pragma once
16
#include "common/configure.h"
17
#include "po/argument_parser.h"
18
#include <string_view>
19
20
namespace WasmEdge {
21
namespace Driver {
22
23
using namespace std::literals;
24
25
struct DriverProposalOptions {
26
  DriverProposalOptions()
27
0
      : PropWASM1(PO::Description("Set as WASM 1.0 standard."sv)),
28
0
        PropWASM2(PO::Description("Set as WASM 2.0 standard."sv)),
29
0
        PropWASM3(PO::Description("Set as WASM 3.0 standard (default)."sv)),
30
0
        PropMutGlobals(PO::Description(
31
0
            "Disable Import/Export of mutable globals proposal"sv)),
32
0
        PropNonTrapF2IConvs(PO::Description(
33
0
            "Disable Non-trapping float-to-int conversions proposal"sv)),
34
0
        PropSignExtendOps(
35
0
            PO::Description("Disable Sign-extension operators proposal"sv)),
36
0
        PropMultiValue(PO::Description("Disable Multi-value proposal"sv)),
37
0
        PropBulkMemOps(
38
0
            PO::Description("Disable Bulk memory operations proposal"sv)),
39
0
        PropRefTypes(PO::Description("Disable Reference types proposal"sv)),
40
0
        PropSIMD(PO::Description("Disable SIMD proposal"sv)),
41
0
        PropTailCall(PO::Description("Disable Tail-call proposal"sv)),
42
0
        PropExtendConst(PO::Description("Disable Extended-const proposal"sv)),
43
0
        PropFunctionReference(
44
0
            PO::Description("Disable Function Reference proposal"sv)),
45
0
        PropGC(PO::Description("Disable GC proposal"sv)),
46
0
        PropMultiMem(PO::Description("Disable Multiple memories proposal"sv)),
47
0
        PropRelaxedSIMD(PO::Description("Disable Relaxed SIMD proposal"sv)),
48
0
        PropExceptionHandling(
49
0
            PO::Description("Disable Exception handling proposal"sv)),
50
0
        PropMemory64(PO::Description("Disable Memory64 proposal"sv)),
51
0
        PropThreads(PO::Description("Enable Threads proposal"sv)),
52
0
        PropAll(PO::Description("Enable all features"sv)) {}
53
54
  PO::Option<PO::Toggle> PropWASM1;
55
  PO::Option<PO::Toggle> PropWASM2;
56
  PO::Option<PO::Toggle> PropWASM3;
57
  PO::Option<PO::Toggle> PropMutGlobals;
58
  PO::Option<PO::Toggle> PropNonTrapF2IConvs;
59
  PO::Option<PO::Toggle> PropSignExtendOps;
60
  PO::Option<PO::Toggle> PropMultiValue;
61
  PO::Option<PO::Toggle> PropBulkMemOps;
62
  PO::Option<PO::Toggle> PropRefTypes;
63
  PO::Option<PO::Toggle> PropSIMD;
64
  PO::Option<PO::Toggle> PropTailCall;
65
  PO::Option<PO::Toggle> PropExtendConst;
66
  PO::Option<PO::Toggle> PropFunctionReference;
67
  PO::Option<PO::Toggle> PropGC;
68
  PO::Option<PO::Toggle> PropMultiMem;
69
  PO::Option<PO::Toggle> PropRelaxedSIMD;
70
  PO::Option<PO::Toggle> PropExceptionHandling;
71
  PO::Option<PO::Toggle> PropMemory64;
72
  PO::Option<PO::Toggle> PropThreads;
73
  PO::Option<PO::Toggle> PropAll;
74
75
0
  void addProposalOptions(PO::ArgumentParser &Parser) noexcept {
76
0
    Parser.add_option("wasm-1"sv, PropWASM1)
77
0
        .add_option("wasm-2"sv, PropWASM2)
78
0
        .add_option("wasm-3"sv, PropWASM3)
79
0
        .add_option("disable-import-export-mut-globals"sv, PropMutGlobals)
80
0
        .add_option("disable-non-trap-float-to-int"sv, PropNonTrapF2IConvs)
81
0
        .add_option("disable-sign-extension-operators"sv, PropSignExtendOps)
82
0
        .add_option("disable-multi-value"sv, PropMultiValue)
83
0
        .add_option("disable-bulk-memory"sv, PropBulkMemOps)
84
0
        .add_option("disable-reference-types"sv, PropRefTypes)
85
0
        .add_option("disable-simd"sv, PropSIMD)
86
0
        .add_option("disable-tail-call"sv, PropTailCall)
87
0
        .add_option("disable-extended-const"sv, PropExtendConst)
88
0
        .add_option("disable-function-reference"sv, PropFunctionReference)
89
0
        .add_option("disable-gc"sv, PropGC)
90
0
        .add_option("disable-multi-memory"sv, PropMultiMem)
91
0
        .add_option("disable-relaxed-simd"sv, PropRelaxedSIMD)
92
0
        .add_option("disable-exception-handling"sv, PropExceptionHandling)
93
0
        .add_option("disable-memory64"sv, PropMemory64)
94
0
        .add_option("enable-threads"sv, PropThreads)
95
0
        .add_option("enable-all"sv, PropAll);
96
0
  }
97
};
98
99
Configure
100
createProposalConfigure(const struct DriverProposalOptions &Opt) noexcept;
101
102
} // namespace Driver
103
} // namespace WasmEdge