Skip to content

Commit 09e1daa

Browse files
committed
win7
1 parent 4eb1612 commit 09e1daa

File tree

13 files changed

+5
-106
lines changed

13 files changed

+5
-106
lines changed

library/backtrace

library/std/src/sys/pal/windows/c.rs

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ pub const INVALID_HANDLE_VALUE: HANDLE = ::core::ptr::without_provenance_mut(-1i
1919
pub const EXIT_SUCCESS: u32 = 0;
2020
pub const EXIT_FAILURE: u32 = 1;
2121

22-
#[cfg(target_vendor = "win7")]
2322
pub const CONDITION_VARIABLE_INIT: CONDITION_VARIABLE = CONDITION_VARIABLE { Ptr: ptr::null_mut() };
24-
#[cfg(target_vendor = "win7")]
2523
pub const SRWLOCK_INIT: SRWLOCK = SRWLOCK { Ptr: ptr::null_mut() };
2624
#[cfg(not(target_thread_local))]
2725
pub const INIT_ONCE_STATIC_INIT: INIT_ONCE = INIT_ONCE { Ptr: ptr::null_mut() };
@@ -109,16 +107,6 @@ if #[cfg(not(target_vendor = "uwp"))] {
109107
}
110108

111109
// Use raw-dylib to import ProcessPrng as we can't rely on there being an import library.
112-
#[cfg(not(target_vendor = "win7"))]
113-
#[cfg_attr(
114-
target_arch = "x86",
115-
link(name = "bcryptprimitives", kind = "raw-dylib", import_name_type = "undecorated")
116-
)]
117-
#[cfg_attr(not(target_arch = "x86"), link(name = "bcryptprimitives", kind = "raw-dylib"))]
118-
extern "system" {
119-
pub fn ProcessPrng(pbdata: *mut u8, cbdata: usize) -> BOOL;
120-
}
121-
122110
// Functions that aren't available on every version of Windows that we support,
123111
// but we still use them and just provide some form of a fallback implementation.
124112
compat_fn_with_fallback! {
@@ -138,7 +126,6 @@ compat_fn_with_fallback! {
138126

139127
// >= Win8 / Server 2012
140128
// https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime
141-
#[cfg(target_vendor = "win7")]
142129
pub fn GetSystemTimePreciseAsFileTime(lpsystemtimeasfiletime: *mut FILETIME) -> () {
143130
unsafe { GetSystemTimeAsFileTime(lpsystemtimeasfiletime) }
144131
}
@@ -150,33 +137,7 @@ compat_fn_with_fallback! {
150137
}
151138
}
152139

153-
#[cfg(not(target_vendor = "win7"))]
154-
// Use raw-dylib to import synchronization functions to workaround issues with the older mingw import library.
155-
#[cfg_attr(
156-
target_arch = "x86",
157-
link(
158-
name = "api-ms-win-core-synch-l1-2-0",
159-
kind = "raw-dylib",
160-
import_name_type = "undecorated"
161-
)
162-
)]
163-
#[cfg_attr(
164-
not(target_arch = "x86"),
165-
link(name = "api-ms-win-core-synch-l1-2-0", kind = "raw-dylib")
166-
)]
167-
extern "system" {
168-
pub fn WaitOnAddress(
169-
address: *const c_void,
170-
compareaddress: *const c_void,
171-
addresssize: usize,
172-
dwmilliseconds: u32,
173-
) -> BOOL;
174-
pub fn WakeByAddressSingle(address: *const c_void);
175-
pub fn WakeByAddressAll(address: *const c_void);
176-
}
177-
178140
// These are loaded by `load_synch_functions`.
179-
#[cfg(target_vendor = "win7")]
180141
compat_fn_optional! {
181142
pub fn WaitOnAddress(
182143
address: *const c_void,
@@ -187,11 +148,9 @@ compat_fn_optional! {
187148
pub fn WakeByAddressSingle(address: *const c_void);
188149
}
189150

190-
#[cfg(any(target_vendor = "win7", target_vendor = "uwp"))]
191151
compat_fn_with_fallback! {
192152
pub static NTDLL: &CStr = c"ntdll";
193153

194-
#[cfg(target_vendor = "win7")]
195154
pub fn NtCreateKeyedEvent(
196155
KeyedEventHandle: *mut HANDLE,
197156
DesiredAccess: u32,
@@ -200,7 +159,6 @@ compat_fn_with_fallback! {
200159
) -> NTSTATUS {
201160
panic!("keyed events not available")
202161
}
203-
#[cfg(target_vendor = "win7")]
204162
pub fn NtReleaseKeyedEvent(
205163
EventHandle: HANDLE,
206164
Key: *const c_void,
@@ -209,7 +167,6 @@ compat_fn_with_fallback! {
209167
) -> NTSTATUS {
210168
panic!("keyed events not available")
211169
}
212-
#[cfg(target_vendor = "win7")]
213170
pub fn NtWaitForKeyedEvent(
214171
EventHandle: HANDLE,
215172
Key: *const c_void,

library/std/src/sys/pal/windows/compat.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ use crate::sys::c;
3737
// file an issue for discussion; currently we don't guarantee any functionality
3838
// before main.
3939
// See https://docs.microsoft.com/en-us/cpp/c-runtime-library/crt-initialization?view=msvc-170
40-
#[cfg(target_vendor = "win7")]
4140
#[used]
4241
#[link_section = ".CRT$XCT"]
4342
static INIT_TABLE_ENTRY: unsafe extern "C" fn() = init;
@@ -52,7 +51,6 @@ static INIT_TABLE_ENTRY: unsafe extern "C" fn() = init;
5251
/// negative performance impact in practical situations.
5352
///
5453
/// Currently we only preload `WaitOnAddress` and `WakeByAddressSingle`.
55-
#[cfg(target_vendor = "win7")]
5654
unsafe extern "C" fn init() {
5755
// In an exe this code is executed before main() so is single threaded.
5856
// In a DLL the system's loader lock will be held thereby synchronizing
@@ -199,7 +197,6 @@ macro_rules! compat_fn_with_fallback {
199197
/// Optionally loaded functions.
200198
///
201199
/// Relies on the functions being pre-loaded elsewhere.
202-
#[cfg(target_vendor = "win7")]
203200
macro_rules! compat_fn_optional {
204201
($(
205202
$(#[$meta:meta])*
@@ -232,7 +229,6 @@ macro_rules! compat_fn_optional {
232229
}
233230

234231
/// Load all needed functions from "api-ms-win-core-synch-l1-2-0".
235-
#[cfg(target_vendor = "win7")]
236232
pub(super) fn load_synch_functions() {
237233
fn try_load() -> Option<()> {
238234
use crate::sync::atomic::Ordering;

library/std/src/sys/pal/windows/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ pub mod args;
1818
pub mod c;
1919
pub mod env;
2020
pub mod fs;
21-
#[cfg(not(target_vendor = "win7"))]
22-
pub mod futex;
2321
pub mod handle;
2422
pub mod io;
2523
pub mod net;

library/std/src/sys/pal/windows/os.rs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -320,33 +320,6 @@ pub fn temp_dir() -> PathBuf {
320320
super::fill_utf16_buf(|buf, sz| unsafe { c::GetTempPath2W(sz, buf) }, super::os2path).unwrap()
321321
}
322322

323-
#[cfg(all(not(target_vendor = "uwp"), not(target_vendor = "win7")))]
324-
fn home_dir_crt() -> Option<PathBuf> {
325-
unsafe {
326-
// Defined in processthreadsapi.h.
327-
const CURRENT_PROCESS_TOKEN: usize = -4_isize as usize;
328-
329-
super::fill_utf16_buf(
330-
|buf, mut sz| {
331-
// GetUserProfileDirectoryW does not quite use the usual protocol for
332-
// negotiating the buffer size, so we have to translate.
333-
match c::GetUserProfileDirectoryW(
334-
ptr::without_provenance_mut(CURRENT_PROCESS_TOKEN),
335-
buf,
336-
&mut sz,
337-
) {
338-
0 if api::get_last_error() != WinError::INSUFFICIENT_BUFFER => 0,
339-
0 => sz,
340-
_ => sz - 1, // sz includes the null terminator
341-
}
342-
},
343-
super::os2path,
344-
)
345-
.ok()
346-
}
347-
}
348-
349-
#[cfg(target_vendor = "win7")]
350323
fn home_dir_crt() -> Option<PathBuf> {
351324
unsafe {
352325
use crate::sys::handle::Handle;

library/std/src/sys/pal/windows/stdio.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,6 @@ fn is_console(handle: c::HANDLE) -> bool {
8585
}
8686

8787
/// Returns true if the attached console's code page is currently UTF-8.
88-
#[cfg(not(target_vendor = "win7"))]
89-
fn is_utf8_console() -> bool {
90-
unsafe { c::GetConsoleOutputCP() == c::CP_UTF8 }
91-
}
92-
93-
#[cfg(target_vendor = "win7")]
9488
fn is_utf8_console() -> bool {
9589
// Windows 7 has a fun "feature" where WriteFile on a console handle will return
9690
// the number of UTF-16 code units written and not the number of bytes from the input string.

library/std/src/sys/random/windows.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
use crate::sys::c;
22

3-
#[cfg(not(target_vendor = "win7"))]
4-
#[inline]
5-
pub fn fill_bytes(bytes: &mut [u8]) {
6-
let ret = unsafe { c::ProcessPrng(bytes.as_mut_ptr(), bytes.len()) };
7-
// ProcessPrng is documented as always returning `TRUE`.
8-
// https://learn.microsoft.com/en-us/windows/win32/seccng/processprng#return-value
9-
debug_assert_eq!(ret, c::TRUE);
10-
}
11-
12-
#[cfg(target_vendor = "win7")]
133
pub fn fill_bytes(mut bytes: &mut [u8]) {
144
while !bytes.is_empty() {
155
let len = bytes.len().try_into().unwrap_or(u32::MAX);

library/std/src/sys/sync/condvar/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
cfg_if::cfg_if! {
22
if #[cfg(any(
3-
all(target_os = "windows", not(target_vendor="win7")),
43
target_os = "linux",
54
target_os = "android",
65
target_os = "freebsd",
@@ -18,7 +17,7 @@ cfg_if::cfg_if! {
1817
))] {
1918
mod pthread;
2019
pub use pthread::Condvar;
21-
} else if #[cfg(all(target_os = "windows", target_vendor = "win7"))] {
20+
} else if #[cfg(target_os = "windows")] {
2221
mod windows7;
2322
pub use windows7::Condvar;
2423
} else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] {

library/std/src/sys/sync/mutex/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
cfg_if::cfg_if! {
22
if #[cfg(any(
3-
all(target_os = "windows", not(target_vendor = "win7")),
43
target_os = "linux",
54
target_os = "android",
65
target_os = "freebsd",
@@ -20,7 +19,7 @@ cfg_if::cfg_if! {
2019
))] {
2120
mod pthread;
2221
pub use pthread::Mutex;
23-
} else if #[cfg(all(target_os = "windows", target_vendor = "win7"))] {
22+
} else if #[cfg(target_os = "windows")] {
2423
mod windows7;
2524
pub use windows7::{Mutex, raw};
2625
} else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] {

library/std/src/sys/sync/once/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
cfg_if::cfg_if! {
1111
if #[cfg(any(
12-
all(target_os = "windows", not(target_vendor="win7")),
1312
target_os = "linux",
1413
target_os = "android",
1514
all(target_arch = "wasm32", target_feature = "atomics"),

library/std/src/sys/sync/rwlock/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
cfg_if::cfg_if! {
22
if #[cfg(any(
3-
all(target_os = "windows", not(target_vendor = "win7")),
43
target_os = "linux",
54
target_os = "android",
65
target_os = "freebsd",
@@ -14,7 +13,7 @@ cfg_if::cfg_if! {
1413
pub use futex::RwLock;
1514
} else if #[cfg(any(
1615
target_family = "unix",
17-
all(target_os = "windows", target_vendor = "win7"),
16+
target_os = "windows",
1817
all(target_vendor = "fortanix", target_env = "sgx"),
1918
target_os = "xous",
2019
))] {

library/std/src/sys/sync/thread_parking/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
cfg_if::cfg_if! {
22
if #[cfg(any(
3-
all(target_os = "windows", not(target_vendor = "win7")),
43
target_os = "linux",
54
target_os = "android",
65
all(target_arch = "wasm32", target_feature = "atomics"),
@@ -19,7 +18,7 @@ cfg_if::cfg_if! {
1918
))] {
2019
mod id;
2120
pub use id::Parker;
22-
} else if #[cfg(target_vendor = "win7")] {
21+
} else if #[cfg(target_os = "windows")] {
2322
mod windows7;
2423
pub use windows7::Parker;
2524
} else if #[cfg(all(target_vendor = "apple", not(miri)))] {

library/std/src/sys/sync/thread_parking/windows7.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ impl Parker {
110110
return;
111111
}
112112

113-
#[cfg(target_vendor = "win7")]
114113
if c::WaitOnAddress::option().is_none() {
115114
return keyed_events::park(self);
116115
}
@@ -138,7 +137,6 @@ impl Parker {
138137
return;
139138
}
140139

141-
#[cfg(target_vendor = "win7")]
142140
if c::WaitOnAddress::option().is_none() {
143141
return keyed_events::park_timeout(self, timeout);
144142
}
@@ -168,7 +166,6 @@ impl Parker {
168166
// with park().
169167
if self.state.swap(NOTIFIED, Release) == PARKED {
170168
unsafe {
171-
#[cfg(target_vendor = "win7")]
172169
if c::WakeByAddressSingle::option().is_none() {
173170
return keyed_events::unpark(self);
174171
}
@@ -182,7 +179,6 @@ impl Parker {
182179
}
183180
}
184181

185-
#[cfg(target_vendor = "win7")]
186182
mod keyed_events {
187183
use core::pin::Pin;
188184
use core::ptr;

0 commit comments

Comments
 (0)