Skip to content

Any reason why the #[exception] macro disallows extern "C" fns? #575

Open
@SCingolani

Description

@SCingolani

I have the following signature for my HardFault handler:

#[exception(trampoline = false)]
#[naked]
unsafe fn HardFault() -> ! {
...

This triggers the compiler warning

warning: Rust ABI is unsupported in naked functions
note: #[warn(undefined_naked_function_abi)] on by default

Which could be avoided by modifying the signature to be:

#[exception(trampoline = false)]
#[naked]
unsafe extern "C" fn HardFault() -> ! {
...

But this is not accepted by the macro:

HardFault handler must have signature unsafe fn() -> !

Is there any reason for the macro to not allow specifying the ABI?

Also, could someone point me as to why does the following not produce the same warning?

#[pre_init]
#[naked]
unsafe fn pre_init() {
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions