mirror of
https://github.com/bdwgc/bdwgc-rust.git
synced 2026-09-25 19:53:40 -06:00
Stricter linting rule (#582)
This commit is contained in:
@@ -28,3 +28,7 @@ dbg_macro = "deny"
|
|||||||
missing_const_for_fn = "deny"
|
missing_const_for_fn = "deny"
|
||||||
std_instead_of_alloc = "deny"
|
std_instead_of_alloc = "deny"
|
||||||
std_instead_of_core = "deny"
|
std_instead_of_core = "deny"
|
||||||
|
|
||||||
|
[lints.rust]
|
||||||
|
missing_docs = "deny"
|
||||||
|
warnings = "deny"
|
||||||
|
|||||||
@@ -1,71 +1,76 @@
|
|||||||
|
//! A build script.
|
||||||
|
|
||||||
const LIB_ATOMIC_OPS_DIR: &str = "vendor/libatomic_ops";
|
const LIB_ATOMIC_OPS_DIR: &str = "vendor/libatomic_ops";
|
||||||
const LIB_GC_DIR: &str = "vendor/bdwgc";
|
const LIB_GC_DIR: &str = "vendor/bdwgc";
|
||||||
|
|
||||||
#[cfg(feature = "autotools")]
|
cfg_select! {
|
||||||
fn main() {
|
feature = "cmake" => {
|
||||||
for dir in &[LIB_ATOMIC_OPS_DIR, LIB_GC_DIR] {
|
fn main() {
|
||||||
std::process::Command::new("sh")
|
use cmake::Config;
|
||||||
.arg("-c")
|
use std::path::Path;
|
||||||
.arg(format!("cd {dir} && ./autogen.sh"))
|
|
||||||
.output()
|
let libatomic_include_path = Path::new(LIB_ATOMIC_OPS_DIR)
|
||||||
.unwrap();
|
.join("src")
|
||||||
|
.canonicalize()
|
||||||
|
.unwrap()
|
||||||
|
.display()
|
||||||
|
.to_string()
|
||||||
|
.replace(r"\\?\", "");
|
||||||
|
|
||||||
|
let dst = Config::new(LIB_GC_DIR)
|
||||||
|
.profile("Release")
|
||||||
|
.define("GC_BUILD_SHARED_LIBS", "FALSE")
|
||||||
|
.cflag(format!("-I{}", libatomic_include_path))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
println!(
|
||||||
|
"cargo:rustc-link-search=native={}",
|
||||||
|
dst.join("lib").display()
|
||||||
|
);
|
||||||
|
println!("cargo:rustc-link-lib=static=gc");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
feature = "autotools" => {
|
||||||
|
fn main() {
|
||||||
|
for dir in &[LIB_ATOMIC_OPS_DIR, LIB_GC_DIR] {
|
||||||
|
std::process::Command::new("sh")
|
||||||
|
.arg("-c")
|
||||||
|
.arg(format!("cd {dir} && ./autogen.sh"))
|
||||||
|
.output()
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
let dst = autotools::Config::new(LIB_ATOMIC_OPS_DIR)
|
let dst = autotools::Config::new(LIB_ATOMIC_OPS_DIR)
|
||||||
.cflag("-fPIC")
|
.cflag("-fPIC")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
println!(
|
println!(
|
||||||
"cargo:rustc-link-search=native={}",
|
"cargo:rustc-link-search=native={}",
|
||||||
dst.join("lib").display()
|
dst.join("lib").display()
|
||||||
);
|
);
|
||||||
println!("cargo:rustc-link-lib=static=atomic_ops");
|
println!("cargo:rustc-link-lib=static=atomic_ops");
|
||||||
|
|
||||||
let dst = autotools::Config::new(LIB_GC_DIR)
|
let dst = autotools::Config::new(LIB_GC_DIR)
|
||||||
.cflag(format!(
|
.cflag(format!(
|
||||||
// spell-checker: disable-next-line
|
// spell-checker: disable-next-line
|
||||||
"-I{} -L/lib/x86_64-linux-gnu -lpthread -fPIC",
|
"-I{} -L/lib/x86_64-linux-gnu -lpthread -fPIC",
|
||||||
dst.join("include").display()
|
dst.join("include").display()
|
||||||
))
|
))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
println!(
|
println!(
|
||||||
"cargo:rustc-link-search=native={}",
|
"cargo:rustc-link-search=native={}",
|
||||||
dst.join("lib").display()
|
dst.join("lib").display()
|
||||||
);
|
);
|
||||||
println!("cargo:rustc-link-lib=static=gc");
|
println!("cargo:rustc-link-lib=static=gc");
|
||||||
|
|
||||||
for dir in &[LIB_ATOMIC_OPS_DIR, LIB_GC_DIR] {
|
for dir in &[LIB_ATOMIC_OPS_DIR, LIB_GC_DIR] {
|
||||||
std::process::Command::new("sh")
|
std::process::Command::new("sh")
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg(format!("cd {dir} && git clean -dfx"))
|
.arg(format!("cd {dir} && git clean -dfx"))
|
||||||
.output()
|
.output()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "cmake")]
|
|
||||||
fn main() {
|
|
||||||
use cmake::Config;
|
|
||||||
use std::path::Path;
|
|
||||||
|
|
||||||
let libatomic_include_path = Path::new(LIB_ATOMIC_OPS_DIR)
|
|
||||||
.join("src")
|
|
||||||
.canonicalize()
|
|
||||||
.unwrap()
|
|
||||||
.display()
|
|
||||||
.to_string()
|
|
||||||
.replace(r"\\?\", "");
|
|
||||||
|
|
||||||
let dst = Config::new(LIB_GC_DIR)
|
|
||||||
.profile("Release")
|
|
||||||
.define("GC_BUILD_SHARED_LIBS", "FALSE")
|
|
||||||
.cflag(format!("-I{}", libatomic_include_path))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
println!(
|
|
||||||
"cargo:rustc-link-search=native={}",
|
|
||||||
dst.join("lib").display()
|
|
||||||
);
|
|
||||||
println!("cargo:rustc-link-lib=static=gc");
|
|
||||||
}
|
|
||||||
|
|||||||
+5
-2
@@ -3,8 +3,10 @@
|
|||||||
|
|
||||||
mod error;
|
mod error;
|
||||||
|
|
||||||
use core::alloc::{GlobalAlloc, Layout};
|
use core::{
|
||||||
use core::ptr::null;
|
alloc::{GlobalAlloc, Layout},
|
||||||
|
ptr::null,
|
||||||
|
};
|
||||||
use libc::{c_int, c_void, size_t};
|
use libc::{c_int, c_void, size_t};
|
||||||
|
|
||||||
const GC_SUCCESS: c_int = 0;
|
const GC_SUCCESS: c_int = 0;
|
||||||
@@ -38,6 +40,7 @@ unsafe extern "C" {
|
|||||||
) -> *mut c_void;
|
) -> *mut c_void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// An allocator.
|
||||||
pub struct Allocator;
|
pub struct Allocator;
|
||||||
|
|
||||||
impl Allocator {
|
impl Allocator {
|
||||||
|
|||||||
Reference in New Issue
Block a user