pma: add crate feature to control debugging printfs

This commit is contained in:
Edward Amsden 2023-12-15 11:16:38 -06:00
parent 3acf8e74c1
commit dd814b3e1f
3 changed files with 5 additions and 1 deletions

View File

@ -12,6 +12,8 @@ edition = "2018"
# Please keep these alphabetized
[dependencies]
ares_macros = { path = "../ares_macros" }
# Use this when debugging requires the debug printfs in the PMA
# ares_pma = { path = "../ares_pma", features=["debug_prints"] }
ares_pma = { path = "../ares_pma" }
assert_no_alloc = "1.1.2"
# use this when debugging requires allocation (e.g. eprintln)

View File

@ -11,3 +11,5 @@ edition = "2018"
bindgen = "0.69.1"
cc = "1.0"
[features]
debug_prints = []

View File

@ -8,7 +8,7 @@ use bindgen::CargoCallbacks;
fn main() {
let profile = env::var("PROFILE").unwrap();
let opt_level = env::var("OPT_LEVEL").unwrap();
let define_debug = if profile == "debug" {
let define_debug = if env::var("CARGO_FEATURE_DEBUG_PRINTS").is_ok() {
"-DDEBUG"
} else {
"-UDEBUG"