Skip to content

Commit 8f47253

Browse files
authored
Improve windows-bindgen for std usage (#2610)
1 parent f1b1edd commit 8f47253

File tree

5 files changed

+8
-11
lines changed

5 files changed

+8
-11
lines changed

crates/libs/bindgen/src/args.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ where
3030
}
3131
if expand {
3232
for args in crate::read_file_lines(&arg)? {
33-
from_string(result, &args)?;
33+
if !args.starts_with("//") {
34+
from_string(result, &args)?;
35+
}
3436
}
3537
} else if arg == "--etc" {
3638
expand = true;

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ pub fn gen_sys_handle(writer: &Writer, def: TypeDef) -> TokenStream {
1414
Type::ISize if writer.std => quote! {
1515
pub type #ident = *mut ::core::ffi::c_void;
1616
},
17-
Type::USize if writer.std => quote! {
18-
#[cfg(target_pointer_width = "32")]
19-
pub type #ident = u32;
20-
#[cfg(target_pointer_width = "64")]
21-
pub type #ident = u64;
22-
},
2317
underlying_type => {
2418
let signature = writer.type_default_name(&underlying_type);
2519

crates/tests/standalone/src/b_std.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ pub type HANDLE = *mut ::core::ffi::c_void;
3636
pub type HMODULE = *mut ::core::ffi::c_void;
3737
pub type PCSTR = *const u8;
3838
pub type PSTR = *mut u8;
39-
#[cfg(target_pointer_width = "32")]
40-
pub type SOCKET = u32;
41-
#[cfg(target_pointer_width = "64")]
42-
pub type SOCKET = u64;
39+
pub type SOCKET = usize;
4340
pub type WIN32_ERROR = u32;
4441
pub type WINSOCK_SOCKET_TYPE = i32;

crates/tools/core/bindings.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// These will use `windows-sys` style bindings.
2+
13
--out crates/libs/core/src/imp/bindings.rs
24
--config flatten sys minimal
35

crates/tools/core/com_bindings.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// These will use `windows` style bindings and include COM APIs.
2+
13
--out crates/libs/core/src/imp/com_bindings.rs
24
--config flatten minimal
35

0 commit comments

Comments
 (0)