Add a "std" feature to be friendlier for cargo nono.

This commit is contained in:
Dan Gohman
2021-08-25 10:14:00 -07:00
parent 403c2ea315
commit dce54115af
4 changed files with 9 additions and 8 deletions
+3 -2
View File
@@ -30,8 +30,9 @@ jobs:
cargo check --features v5_4
cargo check --features v5_11
cargo check --features "v3_2 netlink"
cargo check --no-default-features --features "v5_11 netlink"
cargo check --features no_std
cargo check --no-default-features --features "std v5_11 netlink"
cargo check --no-default-features --features "no_std v5_4 netlink"
cargo check --no-default-features --features "no_std general errno"
gen:
name: Update generated files
+2 -1
View File
@@ -31,5 +31,6 @@ v4_4 = []
v4_20 = []
v5_4 = []
v5_11 = []
default = ["general", "errno"]
default = ["std", "general", "errno"]
std = []
no_std = ['cty']
+2 -1
View File
@@ -239,7 +239,8 @@ fn main() {
}
}
writeln!(cargo_toml, "default = [{}]", DEFAULT_FEATURES).unwrap();
writeln!(cargo_toml, "default = [\"std\", {}]", DEFAULT_FEATURES).unwrap();
writeln!(cargo_toml, "std = []").unwrap();
writeln!(cargo_toml, "no_std = ['cty']").unwrap();
// Reset the `linux` directory back to the original branch.
+2 -4
View File
@@ -1,9 +1,7 @@
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
#![no_std]
#![cfg_attr(not(feature = "std"), no_std)]
#[cfg(not(feature = "no_std"))]
extern crate std;
#[cfg(not(feature = "no_std"))]
#[cfg(feature = "std")]
use std::os::raw as ctypes;
#[cfg(feature = "no_std")]