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

automock should strip #[link_name = "..."] #502

Closed
corecode opened this issue Jul 19, 2023 · 2 comments · Fixed by #503
Closed

automock should strip #[link_name = "..."] #502

corecode opened this issue Jul 19, 2023 · 2 comments · Fixed by #503

Comments

@corecode
Copy link

Building mocks for bindgen output for inline static functions results in:

warning: attribute should be applied to a foreign function or static
     --> bindings.rs:58960:5
      |
57180 | #[mockall::automock]
      | -------------------- not a foreign function or static
...
58960 |     #[link_name = "FooName__extern"]
      |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      |
      = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
@asomers
Copy link
Owner

asomers commented Jul 19, 2023

Interesting. Can you share more of the source? Or better yet, a complete example?

@corecode
Copy link
Author

the fragment in question is generated code like this:

extern "C" {
    #[doc = "blablabla"]
    #[link_name = "SystemCoreClockGet__extern"]
    pub fn SystemCoreClockGet() -> u32;
}

which is wrapped in an #[automock] mod functions { ... }

asomers added a commit that referenced this issue Jul 20, 2023
Avoid emitting this attribute in the generated code, which causes
`unused_attribute` warnings.

Fixes #502
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

Successfully merging a pull request may close this issue.

2 participants