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

Don't generate #[no_mangle] within extern blocks #679

Open
kkysen opened this issue Sep 25, 2022 · 0 comments
Open

Don't generate #[no_mangle] within extern blocks #679

kkysen opened this issue Sep 25, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@kkysen
Copy link
Contributor

kkysen commented Sep 25, 2022

Currently, c2rust transpile generates #[no_mangle] on all foreign functions declared within extern blocks. This is not needed, as symbol names in extern blocks are not mangled to begin with. Currently, this is just a #[warn(unused_attributes)] warning, but it will become a hard error in later versions of rustc, so we should stop emitting it.

Here is an example warnings:

warning: `#[no_mangle]` has no effect on a foreign function
 --> src/bin/converted_hello.rs:6:1
  |
6 | #[no_mangle]
  | ^^^^^^^^^^^^ help: remove this attribute
7 | fn printf(_: *const libc::c_char, _: ...) -> libc::c_int;
  | --------------------------------------------------------- foreign function
  |
  = note: `#[warn(unused_attributes)]` on by default
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
  = note: symbol names in extern blocks are not mangled
@kkysen kkysen added the bug Something isn't working label Sep 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant