diff options
author | bors <bors@rust-lang.org> | 2023-04-26 14:44:23 +0000 |
---|---|---|
committer | bors <bors@rust-lang.org> | 2023-04-26 14:44:23 +0000 |
commit | 8a3a8be77dab80991588023fad5cca6f4bac671f (patch) | |
tree | 8051433323de96cb4eae73b2f6bd867583182076 /src | |
parent | 4c27d5da3acfe76d3eb0b47687636f405b8da32c (diff) | |
parent | 34866c136d14b835d0a7cb559d29cd1fcecdb7dd (diff) | |
download | rust-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.
Diffstat (limited to 'src')
-rw-r--r-- | src/windows/mod.rs | 18 |
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" { |