From d937f8bfcbfcb2ca27d951600bb3962ef2aa74d1 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Tue, 28 May 2024 05:44:17 +0900 Subject: [PATCH] add test --- tests/expectations/cfg.compat.c | 5 +++++ tests/rust/cfg.rs | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/tests/expectations/cfg.compat.c b/tests/expectations/cfg.compat.c index 053c4052..182d8d14 100644 --- a/tests/expectations/cfg.compat.c +++ b/tests/expectations/cfg.compat.c @@ -95,6 +95,11 @@ typedef struct { #endif ; } ConditionalField; +#define ConditionalField_ZERO (ConditionalField){ +#if defined(X11) +.field = 0 +#endif + } typedef struct { int32_t x; diff --git a/tests/rust/cfg.rs b/tests/rust/cfg.rs index 70893609..3d4f26c7 100644 --- a/tests/rust/cfg.rs +++ b/tests/rust/cfg.rs @@ -49,6 +49,13 @@ struct ConditionalField { field: i32, } +impl ConditionalField { + pub const ZERO: Self = Self { + #[cfg(x11)] + field: 0, + }; +} + #[cfg(all(unix, x11))] #[no_mangle] pub extern "C" fn root(a: FooHandle, c: C)