From ba2f8c20ddc72636738b74128c8bb3194a641b5a Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Mon, 28 Nov 2022 21:06:33 +0100 Subject: [PATCH] qcompilerdetection: Introduce QT_ASAN_ENABLED This allows us to check whether Qt is compiled with ASAN enabled; it is mostly used to disable tests which are too slow under ASAN Change-Id: I381e287c4a72ffefd4cc92850451477032ad4204 Reviewed-by: Thiago Macieira --- src/corelib/global/qcompilerdetection.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 0c27d6ca798..b0df663242b 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -445,6 +445,16 @@ # define __has_include_next(x) 0 #endif +/* + detecting ASAN can be helpful to disable slow tests + clang uses feature, gcc defines __SANITIZE_ADDRESS__ + unconditionally check both in case other compilers mirror + either of those options + */ +#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__) +# define QT_ASAN_ENABLED +#endif + #ifdef __cplusplus # if __has_include() /* remove this check once Integrity, QNX have caught up */ # include