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

Use safe_f! consistently across platforms #1891

Merged
merged 1 commit into from
Sep 13, 2020

Conversation

xonatius
Copy link
Contributor

The pr #1870 introduced safe_f! macro, which made some functions like WIFEXITED and WEXITSTATUS const and safe on linux_like platform only, which causes inconsistency when trying to use those functions in crates compiled across multiple platforms, as using unsafe on those functions will generate unused_unsafe warning on linux platforms and lack of unsafe block will fail compilation on non-linux platforms.

To avoid the inconsistency, this commit applies the same macro for all the same functions on other platforms too.

@rust-highfive
Copy link

r? @JohnTitor

(rust_highfive has picked a reviewer for you, use r? to override)

The pr rust-lang#1870 introduced safe_f! macro, which made some functions like
WIFEXITED and WEXITSTATUS const and safe on linux_like platform only,
which causes inconsistency when trying to use those functions in crates
compiled across multiple platforms, as using unsafe on those functions
will generate unused_unsafe warning on linux platforms and lack of
unsafe block will fail compilation on non-linux platforms.

To avoid the inconsistency, this commit applies the same macro for all
the same functions on other platforms too.
Copy link
Member

@JohnTitor JohnTitor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a reasonable point, thanks!

@JohnTitor JohnTitor merged commit 999e5e1 into rust-lang:master Sep 13, 2020
bors added a commit that referenced this pull request Jan 18, 2021
openbsd: make WIFCONTINUED() safe

it seems it was a missed part of #1891

Found it because rustc -nightly started to use `libc::WIFCONTINUED()` recently in a safe context and the build fail to build on OpenBSD.

Fixes #2001
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 this pull request may close these issues.

3 participants