Coverage Report

Created: 2026-08-08 06:32

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
        PropTailCallDeprecated(PO::Description(
51
0
            "(DEPRECATED) Enable Tail-call proposal. WASM 3.0 includes this "
52
0
            "proposal, and this option will be removed in the future."sv)),
53
0
        PropExtendConstDeprecated(PO::Description(
54
0
            "(DEPRECATED) Enable Extended-const proposal. WASM 3.0 includes "
55
0
            "this proposal, and this option will be removed in the future."sv)),
56
0
        PropFunctionReferenceDeprecated(PO::Description(
57
0
            "(DEPRECATED) Enable Function Reference proposal. WASM 3.0 "
58
0
            "includes this proposal, and this option will be removed in the "
59
0
            "future."sv)),
60
0
        PropGCDeprecated(PO::Description(
61
0
            "(DEPRECATED) Enable GC proposal. WASM 3.0 includes this proposal, "
62
0
            "and this option will be removed in the future."sv)),
63
0
        PropMultiMemDeprecated(PO::Description(
64
0
            "(DEPRECATED) Enable Multiple memories proposal. WASM 3.0 includes "
65
0
            "this proposal, and this option will be removed in the future."sv)),
66
0
        PropRelaxedSIMDDeprecated(PO::Description(
67
0
            "(DEPRECATED) Enable Relaxed SIMD proposal. WASM 3.0 includes this "
68
0
            "proposal, and this option will be removed in the future."sv)),
69
0
        PropExceptionHandlingDeprecated(PO::Description(
70
0
            "(DEPRECATED) Enable Exception handling proposal. WASM 3.0 "
71
0
            "includes this proposal, and this option will be removed in the "
72
0
            "future."sv)),
73
0
        PropMemory64(PO::Description("Disable Memory64 proposal"sv)),
74
0
        PropThreads(PO::Description("Enable Threads proposal"sv)),
75
0
        PropAll(PO::Description("Enable all features"sv)) {}
76
77
  PO::Option<PO::Toggle> PropWASM1;
78
  PO::Option<PO::Toggle> PropWASM2;
79
  PO::Option<PO::Toggle> PropWASM3;
80
  PO::Option<PO::Toggle> PropMutGlobals;
81
  PO::Option<PO::Toggle> PropNonTrapF2IConvs;
82
  PO::Option<PO::Toggle> PropSignExtendOps;
83
  PO::Option<PO::Toggle> PropMultiValue;
84
  PO::Option<PO::Toggle> PropBulkMemOps;
85
  PO::Option<PO::Toggle> PropRefTypes;
86
  PO::Option<PO::Toggle> PropSIMD;
87
  PO::Option<PO::Toggle> PropTailCall;
88
  PO::Option<PO::Toggle> PropExtendConst;
89
  PO::Option<PO::Toggle> PropFunctionReference;
90
  PO::Option<PO::Toggle> PropGC;
91
  PO::Option<PO::Toggle> PropMultiMem;
92
  PO::Option<PO::Toggle> PropRelaxedSIMD;
93
  PO::Option<PO::Toggle> PropExceptionHandling;
94
  PO::Option<PO::Toggle> PropTailCallDeprecated;
95
  PO::Option<PO::Toggle> PropExtendConstDeprecated;
96
  PO::Option<PO::Toggle> PropFunctionReferenceDeprecated;
97
  PO::Option<PO::Toggle> PropGCDeprecated;
98
  PO::Option<PO::Toggle> PropMultiMemDeprecated;
99
  PO::Option<PO::Toggle> PropRelaxedSIMDDeprecated;
100
  PO::Option<PO::Toggle> PropExceptionHandlingDeprecated;
101
  PO::Option<PO::Toggle> PropMemory64;
102
  PO::Option<PO::Toggle> PropThreads;
103
  PO::Option<PO::Toggle> PropAll;
104
105
0
  void addProposalOptions(PO::ArgumentParser &Parser) noexcept {
106
0
    Parser.add_option("wasm-1"sv, PropWASM1)
107
0
        .add_option("wasm-2"sv, PropWASM2)
108
0
        .add_option("wasm-3"sv, PropWASM3)
109
0
        .add_option("disable-import-export-mut-globals"sv, PropMutGlobals)
110
0
        .add_option("disable-non-trap-float-to-int"sv, PropNonTrapF2IConvs)
111
0
        .add_option("disable-sign-extension-operators"sv, PropSignExtendOps)
112
0
        .add_option("disable-multi-value"sv, PropMultiValue)
113
0
        .add_option("disable-bulk-memory"sv, PropBulkMemOps)
114
0
        .add_option("disable-reference-types"sv, PropRefTypes)
115
0
        .add_option("disable-simd"sv, PropSIMD)
116
0
        .add_option("disable-tail-call"sv, PropTailCall)
117
0
        .add_option("disable-extended-const"sv, PropExtendConst)
118
0
        .add_option("disable-function-reference"sv, PropFunctionReference)
119
0
        .add_option("disable-gc"sv, PropGC)
120
0
        .add_option("disable-multi-memory"sv, PropMultiMem)
121
0
        .add_option("disable-relaxed-simd"sv, PropRelaxedSIMD)
122
0
        .add_option("disable-exception-handling"sv, PropExceptionHandling)
123
0
        .add_option("enable-tail-call"sv, PropTailCallDeprecated)
124
0
        .add_option("enable-extended-const"sv, PropExtendConstDeprecated)
125
0
        .add_option("enable-function-reference"sv,
126
0
                    PropFunctionReferenceDeprecated)
127
0
        .add_option("enable-gc"sv, PropGCDeprecated)
128
0
        .add_option("enable-multi-memory"sv, PropMultiMemDeprecated)
129
0
        .add_option("enable-relaxed-simd"sv, PropRelaxedSIMDDeprecated)
130
0
        .add_option("enable-exception-handling"sv,
131
0
                    PropExceptionHandlingDeprecated)
132
0
        .add_option("disable-memory64"sv, PropMemory64)
133
0
        .add_option("enable-threads"sv, PropThreads)
134
0
        .add_option("enable-all"sv, PropAll);
135
0
  }
136
};
137
138
Configure
139
createProposalConfigure(const struct DriverProposalOptions &Opt) noexcept;
140
141
} // namespace Driver
142
} // namespace WasmEdge