Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aya-tool: enable clang_macro_fallback #1129

Merged
merged 2 commits into from
Jan 7, 2025
Merged

Conversation

tamird
Copy link
Member

@tamird tamird commented Jan 2, 2025

Closes #1128.

cc @cppcoffee would you mind testing?


This change is Reviewable

Copy link

netlify bot commented Jan 2, 2025

Deploy Preview for aya-rs-docs failed.

Built without sensitive environment variables

Name Link
🔨 Latest commit 54b6686
🔍 Latest deploy log https://app.netlify.com/sites/aya-rs-docs/deploys/6776e18d3371d40008ed50c0

@mergify mergify bot added the aya-tool Relating to aya-tool label Jan 2, 2025
@cppcoffee
Copy link

cppcoffee commented Jan 3, 2025

The input file content is as follows:

enum { FRAME_TYPE, FRAME_TYPEP, FRAME_LUA };

#define frame_type(f) ((f) & FRAME_TYPE)

The command output is:

# ./target/debug/aya-tool generate --header /tmp/test.h
/* automatically generated by rust-bindgen 0.71.1 */

pub mod _bindgen_ty_1 {
    pub type Type = ::aya_ebpf::cty::c_uint;
    pub const FRAME_TYPE: Type = 0;
    pub const FRAME_TYPEP: Type = 1;
    pub const FRAME_LUA: Type = 2;
}

It also printed debug information to the command line:

bindgen "/tmp/.tmpxaX8ll/test.h" ["--default-enum-style", "moduleconsts", "--no-layout-tests", "--no-derive-default", "--use-core", "--ctypes-prefix", "::aya_ebpf::cty", "--generate", "functions,types,vars,methods,constructors,destructors", "--no-doc-comments", "--no-prepend-enum-name", "--rust-target", "1.82.0", "--clang-macro-fallback", "--", "-Wno-unknown-attributes"]

Only the enum definitions were generated; the macro definitions were not generated.

@tamird
Copy link
Member Author

tamird commented Jan 3, 2025

Thanks for testing. I don't know what more we can do here. Perhaps this should be a bug report for rust-bindgen?

@cppcoffee
Copy link

Reported to rust-bindgen:

rust-lang/rust-bindgen#3065

@tamird
Copy link
Member Author

tamird commented Jan 7, 2025

Merging this to close the issue here, other stuff is tracked in rust-bindgen.

@tamird tamird merged commit 28a28c9 into aya-rs:main Jan 7, 2025
23 of 27 checks passed
@tamird tamird deleted the aya-tool-macros branch January 7, 2025 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aya-tool Relating to aya-tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aya-tool generate from C macro
2 participants