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

--translate-fn-macros translates into wrong stuff #1141

Open
jrmuizel opened this issue Oct 8, 2024 · 0 comments
Open

--translate-fn-macros translates into wrong stuff #1141

jrmuizel opened this issue Oct 8, 2024 · 0 comments

Comments

@jrmuizel
Copy link

jrmuizel commented Oct 8, 2024

void error(const char *lit, int x) {
}

#define unreachable(a) error(a, 5)

void f() {
        unreachable("a");
}

Gets translated to:

#![allow(dead_code, mutable_transmutes, non_camel_case_types, non_snake_case, non_upper_case_globals, unused_assignments, unused_mut)]
#[no_mangle]
pub unsafe extern "C" fn error(mut lit: *const libc::c_char, mut x: libc::c_int) {}
#[no_mangle]
pub unsafe extern "C" fn f() {
    unreachable!("a")(b"a\0" as *const u8 as *const libc::c_char, unreachable!("a"));
}
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

1 participant