Skip to content

Commit

Permalink
aya-tool: extract common helper
Browse files Browse the repository at this point in the history
  • Loading branch information
tamird committed Jan 7, 2025
1 parent 1355a20 commit be6370c
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions aya-tool/src/bindgen.rs
Original file line number Diff line number Diff line change
@@ -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)
}

0 comments on commit be6370c

Please sign in to comment.