Fixed dynlib features to not have UB when allocating.

This commit is contained in:
Sam 2023-01-26 21:26:36 -05:00
parent 1edd064611
commit e31668b188
12 changed files with 17 additions and 31 deletions

5
Cargo.lock generated
View File

@ -7012,7 +7012,6 @@ version = "0.1.0"
dependencies = [
"itertools",
"lazy_static",
"mimalloc",
"rand 0.8.5",
"specs",
"tracing",
@ -7045,6 +7044,8 @@ dependencies = [
"veloren-common-frontend",
"veloren-common-net",
"veloren-server",
"veloren-server-agent",
"veloren-world",
]
[[package]]
@ -7137,7 +7138,6 @@ version = "0.10.0"
dependencies = [
"bytemuck",
"lazy_static",
"mimalloc",
"vek 0.15.8",
"veloren-common",
"veloren-common-dynlib",
@ -7187,7 +7187,6 @@ dependencies = [
"kiddo 0.2.4",
"lazy_static",
"lz-fear",
"mimalloc",
"minifb",
"noise",
"num 0.4.0",

View File

@ -645,8 +645,8 @@
abilities: [],
),
Custom("IcyTalharpa"): (
primary: "common.abilities.music.icy_talharpa",
secondary: "common.abilities.music.icy_talharpa",
primary: Simple(None, "common.abilities.music.icy_talharpa"),
secondary: Simple(None, "common.abilities.music.icy_talharpa"),
abilities: [],
),
Custom("Washboard"): (
@ -675,8 +675,8 @@
abilities: [],
),
Custom("DarkGuitar"): (
primary: "common.abilities.music.dark_guitar",
secondary: "common.abilities.music.dark_guitar",
primary: Simple(None, "common.abilities.music.dark_guitar"),
secondary: Simple(None, "common.abilities.music.dark_guitar"),
abilities: [],
),
Custom("Sitar"): (

View File

@ -23,13 +23,17 @@ default = ["worldgen", "persistent_world"]
tracy = ["common-frontend/tracy"]
plugins = ["server/plugins"]
hot-reloading = ["server/hot-reloading"]
hot-agent = ["server/hot-agent"]
hot-site = ["server/hot-site"]
[dependencies]
server = { package = "veloren-server", path = "../server", default-features = false, features = ["simd"] }
agent = { package = "veloren-server-agent", path = "../server/agent" }
common = { package = "veloren-common", path = "../common" }
common-base = { package = "veloren-common-base", path = "../common/base" }
common-net = { package = "veloren-common-net", path = "../common/net" }
common-frontend = { package = "veloren-common-frontend", path = "../common/frontend" }
world = { package = "veloren-world", path = "../world" }
tokio = { version = "1.14", default-features = false, features = ["rt-multi-thread"] }
num_cpus = "1.0"

View File

@ -1,7 +1,11 @@
#![deny(unsafe_code)]
#![deny(clippy::clone_on_ref_ptr)]
#[cfg(target_os = "windows")]
#[cfg(all(
target_os = "windows",
not(feature = "hot-agent"),
not(feature = "hot-site"),
))]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;

View File

@ -20,6 +20,3 @@ rand = { version = "0.8", features = ["small_rng"] }
tracing = "0.1"
itertools = "0.10"
lazy_static = "1.4.0"
[target.'cfg(windows)'.dependencies]
mimalloc = "0.1.29"

View File

@ -795,7 +795,6 @@ impl<'a> AgentData<'a> {
e
)
});
controller.events.reserve(32);
attack_fn(self, agent, controller, tgt_data, read_data);
}
}

View File

@ -3,10 +3,6 @@
#[cfg(all(feature = "be-dyn-lib", feature = "use-dyn-lib"))]
compile_error!("Can't use both \"be-dyn-lib\" and \"use-dyn-lib\" features at once");
#[cfg(all(target_os = "windows", feature = "be-dyn-lib"))]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
pub mod action_nodes;
pub mod attack;
pub mod consts;

View File

@ -20,6 +20,3 @@ common-dynlib = {package = "veloren-common-dynlib", path = "../../common/dynlib"
# Hot Reloading
lazy_static = {version = "1.4.0", optional = true}
[target.'cfg(windows)'.dependencies]
mimalloc = "0.1.29"

View File

@ -3,10 +3,6 @@
#[cfg(all(feature = "be-dyn-lib", feature = "use-dyn-lib"))]
compile_error!("Can't use both \"be-dyn-lib\" and \"use-dyn-lib\" features at once");
#[cfg(all(target_os = "windows", feature = "be-dyn-lib"))]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
macro_rules! skeleton_impls {
{ struct $Skeleton:ident { $( $(+)? $bone:ident ),* $(,)? $(:: $($field:ident : $field_ty:ty),* $(,)? )? } } => {
#[derive(Clone, Default)]

View File

@ -6,7 +6,8 @@ mod cli;
#[cfg(all(
target_os = "windows",
not(feature = "tracy-memory"),
not(feature = "hot-egui")
not(feature = "hot-egui"),
not(feature = "hot-anim"),
))]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;

View File

@ -78,6 +78,3 @@ required-features = ["bin_compression"]
[[example]]
name = "heightmap_visualization"
required-features = ["bin_compression"]
[target.'cfg(windows)'.dependencies]
mimalloc = "0.1.29"

View File

@ -65,10 +65,6 @@ use vek::*;
#[cfg(all(feature = "be-dyn-lib", feature = "use-dyn-lib"))]
compile_error!("Can't use both \"be-dyn-lib\" and \"use-dyn-lib\" features at once");
#[cfg(all(target_os = "windows", feature = "be-dyn-lib"))]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
#[cfg(feature = "use-dyn-lib")]
use {common_dynlib::LoadedLib, lazy_static::lazy_static, std::sync::Arc, std::sync::Mutex};