Skip to content

Commit 788793f

Browse files
committed
Adds more wasmtime_feature_gc gate, and moves some definition outside the gate
1 parent c575d98 commit 788793f

6 files changed

Lines changed: 13 additions & 3 deletions

File tree

crates/c-api/include/wasmtime/gc.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#ifndef WASMTIME_GC_H
1212
#define WASMTIME_GC_H
1313

14+
#ifdef WASMTIME_FEATURE_GC
15+
1416
#include <wasmtime/val.h>
1517

1618
#ifdef __cplusplus
@@ -593,4 +595,5 @@ WASM_API_EXTERN bool wasmtime_anyref_as_array(wasmtime_context_t *context,
593595
} // extern "C"
594596
#endif
595597

598+
#endif // WASMTIME_FEATURE_GC
596599
#endif // WASMTIME_GC_H

crates/c-api/include/wasmtime/gc.hh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
#ifndef WASMTIME_GC_HH
88
#define WASMTIME_GC_HH
99

10+
#include <wasmtime/config.hh>
11+
12+
#ifdef WASMTIME_FEATURE_GC
1013
#include <vector>
1114
#include <wasmtime/gc.h>
1215
#include <wasmtime/val.hh>
@@ -476,4 +479,6 @@ inline std::optional<ArrayRef> AnyRef::as_array(Store::Context cx) const {
476479

477480
} // namespace wasmtime
478481

482+
#endif // WASMTIME_FEATURE_GC
483+
479484
#endif // WASMTIME_GC_HH

crates/c-api/include/wasmtime/val.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ WASM_API_EXTERN void wasmtime_exnref_clone(const wasmtime_exnref_t *ref,
369369
* After this call, `ref` is left in an undefined state and should not be used.
370370
*/
371371
WASM_API_EXTERN void wasmtime_exnref_unroot(wasmtime_exnref_t *ref);
372+
#endif // WASMTIME_FEATURE_GC
372373

373374
/// \brief Discriminant stored in #wasmtime_val::kind
374375
typedef uint8_t wasmtime_valkind_t;
@@ -395,8 +396,6 @@ typedef uint8_t wasmtime_valkind_t;
395396
/// exnref
396397
#define WASMTIME_EXNREF 8
397398

398-
#endif // WASMTIME_FEATURE_GC
399-
400399
/// \brief A 128-bit value representing the WebAssembly `v128` type. Bytes are
401400
/// stored in little-endian order.
402401
typedef uint8_t wasmtime_v128[16];

crates/c-api/include/wasmtime/val.hh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
#define WASMTIME_VAL_HH
77

88
#include <optional>
9+
#ifdef WASMTIME_FEATURE_GC
910
#include <wasmtime/gc.h>
11+
#endif // WASMTIME_FEATURE_GC
1012
#include <wasmtime/store.hh>
1113
#include <wasmtime/types/val.hh>
1214
#include <wasmtime/val.h>

crates/wasmtime/src/runtime/gc/enabled/eqref.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//! Working with GC `eqref`s.
2-
2+
#![cfg(feature = "gc")]
33
use crate::{
44
AnyRef, ArrayRef, ArrayType, AsContext, AsContextMut, GcRefImpl, GcRootIndex, HeapType, I31,
55
OwnedRooted, RefType, Rooted, StructRef, StructType, ValRaw, ValType, WasmTy,

crates/wasmtime/src/runtime/gc/enabled/structref.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//! Working with GC `struct` objects.
2+
#![cfg(feature = "gc")]
23

34
use crate::runtime::vm::VMGcRef;
45
use crate::store::{Asyncness, StoreId};

0 commit comments

Comments
 (0)