summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-04-26 14:44:23 +0000
committerbors <bors@rust-lang.org>2023-04-26 14:44:23 +0000
commit8a3a8be77dab80991588023fad5cca6f4bac671f (patch)
tree8051433323de96cb4eae73b2f6bd867583182076
parent4c27d5da3acfe76d3eb0b47687636f405b8da32c (diff)
parent34866c136d14b835d0a7cb559d29cd1fcecdb7dd (diff)
downloadrust-libc-8a3a8be77dab80991588023fad5cca6f4bac671f.tar.gz
Auto merge of #3226 - ChrisDenton:std-no-legacy, r=JohnTitor
Don't link `legacy_stdio_definitions` from std std on windows-msvc does not use `printf` or `fprintf` so never needs the `legacy_stdio_definitions.lib` import library and will always work fine without it.
-rw-r--r--src/windows/mod.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/windows/mod.rs b/src/windows/mod.rs
index 7f2f1ded19..26bff7f7a6 100644
--- a/src/windows/mod.rs
+++ b/src/windows/mod.rs
@@ -278,13 +278,17 @@ impl ::Clone for fpos_t {
}
// Special handling for all print and scan type functions because of https://github.com/rust-lang/libc/issues/2860
-#[cfg_attr(
- all(windows, target_env = "msvc"),
- link(name = "legacy_stdio_definitions")
-)]
-extern "C" {
- pub fn printf(format: *const c_char, ...) -> ::c_int;
- pub fn fprintf(stream: *mut FILE, format: *const c_char, ...) -> ::c_int;
+cfg_if! {
+ if #[cfg(not(feature = "rustc-dep-of-std"))] {
+ #[cfg_attr(
+ all(windows, target_env = "msvc"),
+ link(name = "legacy_stdio_definitions")
+ )]
+ extern "C" {
+ pub fn printf(format: *const c_char, ...) -> ::c_int;
+ pub fn fprintf(stream: *mut FILE, format: *const c_char, ...) -> ::c_int;
+ }
+ }
}
extern "C" {