diff --git a/crates/macro/src/expand/napi.rs b/crates/macro/src/expand/napi.rs index 79657d84..e56c3046 100644 --- a/crates/macro/src/expand/napi.rs +++ b/crates/macro/src/expand/napi.rs @@ -21,15 +21,16 @@ use syn::{Attribute, Item}; /// } /// /// ``` +#[cfg(feature = "type-def")] static BUILT_FLAG: AtomicBool = AtomicBool::new(false); pub fn expand(attr: TokenStream, input: TokenStream) -> BindgenResult { + #[cfg(feature = "type-def")] if BUILT_FLAG .compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed) .is_ok() { // logic on first macro expansion - #[cfg(feature = "type-def")] prepare_type_def_file(); if let Ok(wasi_register_file) = env::var("WASI_REGISTER_TMP_PATH") { @@ -84,8 +85,10 @@ pub fn expand(attr: TokenStream, input: TokenStream) -> BindgenResult BindgenResult std::io::Result<()> { use std::io::{BufRead, BufReader};