summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2022-11-28 21:06:33 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2022-11-30 04:50:37 +0100
commitba2f8c20ddc72636738b74128c8bb3194a641b5a (patch)
tree2e9898e20db78be3b76c0affa1f37af932932801 /src
parenta38fe10fff1425ba78c6fbed4a3aac2780eebfef (diff)
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 <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qcompilerdetection.h10
1 files changed, 10 insertions, 0 deletions
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(<version>) /* remove this check once Integrity, QNX have caught up */
# include <version>