From 5ab1672fcb6158f0a27235f0f222ce543eac4a04 Mon Sep 17 00:00:00 2001 From: Georg Semmler Date: Fri, 8 Dec 2023 10:44:32 +0100 Subject: [PATCH] Add an asan feature flag --- pq-src/Cargo.toml | 4 ++++ pq-src/build.rs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/pq-src/Cargo.toml b/pq-src/Cargo.toml index 36ed848..19a9941 100644 --- a/pq-src/Cargo.toml +++ b/pq-src/Cargo.toml @@ -25,3 +25,7 @@ cc = "1.0.83" [target.'cfg(not(target_os = "windows"))'.build-dependencies] openssl-src = "300" + +[features] +default = [] +with-asan = [] diff --git a/pq-src/build.rs b/pq-src/build.rs index b3ad83c..ebfb879 100644 --- a/pq-src/build.rs +++ b/pq-src/build.rs @@ -199,6 +199,10 @@ fn main() { format!("{path}/src/include/port/win32_msvc/"), ]); + if cfg!(feature = "with-asan") { + basic_build.flag("-fsanitize=address"); + } + if cfg!(target_os = "linux") { basic_build.define("_GNU_SOURCE", None); }