From 3f8c474def919f46da32897226a7c9f7610f04e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=AE=87=E9=80=B8?= Date: Fri, 7 Mar 2025 23:41:31 +0800 Subject: [PATCH 1/4] Add cygwin support --- src/unix.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/unix.rs b/src/unix.rs index 726748b..5536eef 100644 --- a/src/unix.rs +++ b/src/unix.rs @@ -78,6 +78,7 @@ extern "C" { target_os = "android", target_os = "espidf", target_os = "vxworks", + target_os = "cygwin", target_env = "newlib" ), link_name = "__errno" From 7151cd617d622c988b80a43858782cb68f6f13df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=AE=87=E9=80=B8?= Date: Sat, 8 Mar 2025 02:47:41 +0800 Subject: [PATCH 2/4] Add build.rs to make CI happy --- CHANGELOG.md | 3 +++ build.rs | 4 ++++ 2 files changed, 7 insertions(+) create mode 100644 build.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index ca8040f..3b22de3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ - Add VxWorks support [#105](https://github.com/lambda-fairy/rust-errno/pull/105) +- Add cygwin support + [#106](https://github.com/lambda-fairy/rust-errno/pull/106) + # [0.3.10] - 2024-11-29 - Update to windows-sys 0.59 diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..1e3400d --- /dev/null +++ b/build.rs @@ -0,0 +1,4 @@ +fn main() { + // Cygwin target, added in 1.86 + println!("cargo:rustc-check-cfg=cfg(target_os, values(\"cygwin\"))"); +} From f8bab880a8a02e53830dee840fc1e8c661bdeeb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=AE=87=E9=80=B8?= Date: Sat, 8 Mar 2025 10:12:27 +0800 Subject: [PATCH 3/4] Use lints in Cargo.toml --- Cargo.toml | 4 ++++ build.rs | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) delete mode 100644 build.rs diff --git a/Cargo.toml b/Cargo.toml index bb9aed3..6503ad3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,3 +31,7 @@ libc = { version = "0.2", default-features = false } [features] default = ["std"] std = ["libc/std"] + +[lints.rust.unexpected_cfgs] +level = "warn" +check-cfg = ['cfg(target_os, values("cygwin"))'] diff --git a/build.rs b/build.rs deleted file mode 100644 index 1e3400d..0000000 --- a/build.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - // Cygwin target, added in 1.86 - println!("cargo:rustc-check-cfg=cfg(target_os, values(\"cygwin\"))"); -} From b4f8475c8870f216534167939d6328190f8b5222 Mon Sep 17 00:00:00 2001 From: Chris Wong Date: Sat, 8 Mar 2025 15:29:07 +1100 Subject: [PATCH 4/4] Add TODO to remove the lint config later --- Cargo.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 6503ad3..6bae929 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,6 +32,8 @@ libc = { version = "0.2", default-features = false } default = ["std"] std = ["libc/std"] +# TODO: Remove this exemption when Cygwin support lands in Rust stable +# https://github.com/rust-lang/rust/pull/134999 [lints.rust.unexpected_cfgs] level = "warn" check-cfg = ['cfg(target_os, values("cygwin"))']