From: Willy Tarreau Date: Tue, 16 Jun 2020 17:14:19 +0000 (+0200) Subject: MINOR: version: report the presence of the compiler's address sanitizer X-Git-Tag: v2.2-dev10~34 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7bf484ac91b50bb77dbd901a4df692163287d31f;p=thirdparty%2Fhaproxy.git MINOR: version: report the presence of the compiler's address sanitizer Since we've seen clang emit bad code when the address sanitizer is enabled at -O2, better clearly report it in the version output. It is detected both for clang and gcc (both tested with and without). --- diff --git a/src/version.c b/src/version.c index 135ff8d060..bf67efa763 100644 --- a/src/version.c +++ b/src/version.c @@ -14,8 +14,14 @@ char haproxy_version[] = HAPROXY_VERSION; char haproxy_date[] = HAPROXY_DATE; char stats_version_string[] = STATS_VERSION_STRING; +#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__) +#define SANITIZE_STRING " with address sanitizer" +#else +#define SANITIZE_STRING "" +#endif + #if defined(__clang_version__) -REGISTER_BUILD_OPTS("Built with clang compiler version " __clang_version__); +REGISTER_BUILD_OPTS("Built with clang compiler version " __clang_version__ "" SANITIZE_STRING); #elif defined(__VERSION__) -REGISTER_BUILD_OPTS("Built with gcc compiler version " __VERSION__); +REGISTER_BUILD_OPTS("Built with gcc compiler version " __VERSION__ "" SANITIZE_STRING); #endif