Skip to content

Use safe_f! consistently across platforms#1891

Merged
JohnTitor merged 1 commit intorust-lang:masterfrom
xonatius:1870_more_platforms
Sep 13, 2020
Merged

Use safe_f! consistently across platforms#1891
JohnTitor merged 1 commit intorust-lang:masterfrom
xonatius:1870_more_platforms

Conversation

@xonatius
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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