From be6370c7cddfa40afdccc6f408724f7ee85977ff Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Thu, 2 Jan 2025 13:54:43 -0500 Subject: [PATCH] aya-tool: extract common helper --- aya-tool/src/bindgen.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/aya-tool/src/bindgen.rs b/aya-tool/src/bindgen.rs index 87f73102..8a3fd4dc 100644 --- a/aya-tool/src/bindgen.rs +++ b/aya-tool/src/bindgen.rs @@ -1,23 +1,22 @@ use bindgen::{Builder, EnumVariation}; -pub fn user_builder() -> Builder { +fn common_builder() -> Builder { bindgen::builder() .use_core() .layout_tests(false) .generate_comments(false) .prepend_enum_name(false) - .default_enum_style(EnumVariation::Rust { - non_exhaustive: false, - }) +} + +pub fn user_builder() -> Builder { + common_builder().default_enum_style(EnumVariation::Rust { + non_exhaustive: false, + }) } pub fn bpf_builder() -> Builder { - bindgen::builder() - .use_core() + common_builder() .ctypes_prefix("::aya_ebpf::cty") - .layout_tests(false) - .generate_comments(false) .clang_arg("-Wno-unknown-attributes") .default_enum_style(EnumVariation::ModuleConsts) - .prepend_enum_name(false) }