Skip to content

Commit f69ba3d

Browse files
authored
Remove "std" writer from windows-bindgen (#3130)
1 parent 707e0bb commit f69ba3d

File tree

5 files changed

+8
-31
lines changed

5 files changed

+8
-31
lines changed

crates/libs/bindgen/src/rust/functions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ fn gen_link(writer: &Writer, namespace: &str, signature: &metadata::Signature) -
248248
quote! {}
249249
};
250250

251-
if writer.std || !namespace.starts_with("Windows.") {
251+
if !namespace.starts_with("Windows.") {
252252
let library = library.trim_end_matches(".dll");
253253

254254
quote! {

crates/libs/bindgen/src/rust/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ pub fn from_reader(
3131
let mut writer = Writer::new(reader, output);
3232
writer.package = config.remove("package").is_some();
3333
writer.flatten = config.remove("flatten").is_some();
34-
writer.std = config.remove("std").is_some();
35-
writer.sys = writer.std || config.remove("sys").is_some();
34+
writer.sys = config.remove("sys").is_some();
3635
writer.implement = config.remove("implement").is_some();
3736
writer.minimal = config.remove("minimal").is_some();
3837
writer.no_inner_attributes = config.remove("no-inner-attributes").is_some();

crates/libs/bindgen/src/rust/writer.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ pub struct Writer {
1313
//
1414
// Maybe this macro is the embedable version of the IDL format?! like a more intelligient
1515
// version of the existing interface macro...
16-
pub std: bool, // tweaks for internal std library support
1716
pub sys: bool, // writer sys-style bindings
1817
pub flatten: bool, // strips out namespaces - implies !package
1918
pub package: bool, // default is single file with no cfg - implies !flatten
@@ -33,7 +32,6 @@ impl Writer {
3332
output: output.to_string(),
3433
namespace: "",
3534
implement: false,
36-
std: false,
3735
sys: false,
3836
flatten: false,
3937
package: false,

crates/tests/standalone/src/b_std.rs

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,11 @@
55
dead_code,
66
clippy::all
77
)]
8-
#[link(name = "advapi32")]
9-
extern "system" {
10-
#[link_name = "SystemFunction036"]
11-
pub fn RtlGenRandom(randombuffer: *mut core::ffi::c_void, randombufferlength: u32) -> BOOLEAN;
12-
}
13-
#[link(name = "kernel32")]
14-
extern "system" {
15-
pub fn CloseHandle(hobject: HANDLE) -> BOOL;
16-
}
17-
#[link(name = "kernel32")]
18-
extern "system" {
19-
pub fn GetLastError() -> WIN32_ERROR;
20-
}
21-
#[link(name = "user32")]
22-
extern "cdecl" {
23-
pub fn wsprintfA(param0: PSTR, param1: PCSTR, ...) -> i32;
24-
}
25-
#[link(name = "ws2_32")]
26-
extern "system" {
27-
pub fn socket(af: i32, r#type: WINSOCK_SOCKET_TYPE, protocol: i32) -> SOCKET;
28-
}
8+
windows_targets::link!("advapi32.dll" "system" "SystemFunction036" fn RtlGenRandom(randombuffer : *mut core::ffi::c_void, randombufferlength : u32) -> BOOLEAN);
9+
windows_targets::link!("kernel32.dll" "system" fn CloseHandle(hobject : HANDLE) -> BOOL);
10+
windows_targets::link!("kernel32.dll" "system" fn GetLastError() -> WIN32_ERROR);
11+
windows_targets::link!("user32.dll" "cdecl" fn wsprintfA(param0 : PSTR, param1 : PCSTR, ...) -> i32);
12+
windows_targets::link!("ws2_32.dll" "system" fn socket(af : i32, r#type : WINSOCK_SOCKET_TYPE, protocol : i32) -> SOCKET);
2913
pub type BCRYPT_ALG_HANDLE = *mut core::ffi::c_void;
3014
pub type BOOL = i32;
3115
pub type BOOLEAN = u8;

crates/tools/standalone/src/main.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ fn main() {
107107
],
108108
);
109109

110-
write_std(
110+
write_sys(
111111
&src.join("b_std.rs"),
112112
&[
113113
"Windows.Win32.Foundation.CloseHandle",
@@ -223,10 +223,6 @@ fn write_win(output: &Path, filter: &[&str]) {
223223
riddle(output, filter, &["flatten", "minimal"]);
224224
}
225225

226-
fn write_std(output: &Path, filter: &[&str]) {
227-
riddle(output, filter, &["flatten", "std", "minimal"]);
228-
}
229-
230226
fn write_no_inner_attr(output: &Path, filter: &[&str]) {
231227
riddle(
232228
output,

0 commit comments

Comments
 (0)