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

Produces errors when Rust is enabled #19

Open
tamird opened this issue Oct 9, 2024 · 4 comments
Open

Produces errors when Rust is enabled #19

tamird opened this issue Oct 9, 2024 · 4 comments

Comments

@tamird
Copy link

tamird commented Oct 9, 2024

compile_commands.json contains things like

 {
  "directory": "/Users/tamird/src/linux",
  "command": "OBJTREE=/Users/tamird/src/linux rustc --edition=2021 -Zbinary_dep_depinfo=y -Astable_features -Dunsafe_op_in_unsafe_fn -Dnon_ascii_idents -Wrust_2018_idioms -Wunreachable_pub -Wmissing_docs -Wrustdoc::missing_crate_level_docs -Wclippy::all -Wclippy::mut_mut -Wclippy::needless_bitwise_bool -Wclippy::needless_continue -Wclippy::no_mangle_with_rust_abi -Wclippy::dbg_macro -Cpanic=abort -Cembed-bitcode=n -Clto=n -Cforce-unwind-tables=n -Ccodegen-units=1 -Csymbol-mangling-version=v0 -Crelocation-model=static -Zfunction-sections=n -Wclippy::float_arithmetic --target=aarch64-unknown-none -Ctarget-feature=\"-neon\" -Cforce-unwind-tables=n -Zbranch-protection=bti,pac-ret -Copt-level=2 -Cdebug-assertions=y -Coverflow-checks=y -Cforce-frame-pointers=y -Cdebuginfo=1 @./include/generated/rustc_cfg --emit=dep-info=rust/.bindings.o.d --emit=obj=rust/bindings.o --emit=metadata=rust/libbindings.rmeta --crate-type rlib -L./rust --crate-name bindings rust/bindings/lib.rs --sysroot=/dev/null  ",
  "file": "rust/bindings/lib.rs",
  "output": "rust/bindings.o"
 },

which produces errors in VSCode when I have e.g. rust/bindings/bindings_helper.h open.

@amezin
Copy link
Owner

amezin commented Oct 9, 2024

Do you have any ideas how to filter out Rust entries correctly? Check for rustc in command?

Although these entries aren't really incorrect, they just aren't for C compiler...

@tamird
Copy link
Author

tamird commented Oct 9, 2024

Do you have any ideas how to filter out Rust entries correctly? Check for rustc in command?

Good question! Maybe look for .c in the source file?

Although these entries aren't really incorrect, they just aren't for C compiler...

Right. make rust-analyzer produces rust-project.json which is the Rust analogue of compile_commands.json.

@amezin
Copy link
Owner

amezin commented Oct 15, 2024

I'm sorry, I'm not doing kernel development actively nowadays and have more important things to fix rn.

It would be great if you - or someone else - could make a PR that solves this issue.

By the way, I took a brief look at the upstream compile_commands.json generator - looks like it improved a bit. What's the reason you still use this repository? Is it still worth maintaining?

And, unless there are good reasons, filtering should be done the same way as the upstream script does it (if it does, though).

@tamird
Copy link
Author

tamird commented Oct 15, 2024

I didn't know upstream had a generator! I will use that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants