Skip to content

f! macro makes functions unnecessarily unsafe and extern #1213

Closed
@asomers

Description

@asomers

The f! macro is used to reimplement C macros and inline functions in libc. It eagerly marks these functions as unsafe and extern. However, most of them don't actually need to be unsafe, and none of them need to be extern. Shall I update the f! macro to eliminate the extern and make the unsafe optional? This would be a backwards-compatible change, though it might generate "unnecessary unsafe" warnings in consumer code.

Here's an example of an f! function that plainly doesn't need to be unsafe:

    pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
        status >> 8
    }

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