[compiler-rt] 7810d83 - [GWP-ASan] Respect GWP_ASAN_DEFAULT_ENABLED compile-time macro
Roland McGrath via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 18 10:34:54 PST 2020
Author: Roland McGrath
Date: 2020-11-18T10:34:42-08:00
New Revision: 7810d837864933b49f5e20a970a8e51ea091fa8e
URL: https://github.com/llvm/llvm-project/commit/7810d837864933b49f5e20a970a8e51ea091fa8e
DIFF: https://github.com/llvm/llvm-project/commit/7810d837864933b49f5e20a970a8e51ea091fa8e.diff
LOG: [GWP-ASan] Respect GWP_ASAN_DEFAULT_ENABLED compile-time macro
If the containing allocator build uses -DGWP_ASAN_DEFAULT_ENABLED=false
then the option will default to false. For e.g. Scudo, this is simpler
and more efficient than using -DSCUDO_DEFAULT_OPTIONS=... to set gwp-asan
options that have to be parsed from the string at startup.
Reviewed By: hctim
Differential Revision: https://reviews.llvm.org/D91463
Added:
Modified:
compiler-rt/lib/gwp_asan/options.inc
Removed:
################################################################################
diff --git a/compiler-rt/lib/gwp_asan/options.inc b/compiler-rt/lib/gwp_asan/options.inc
index c81e1f47c722..67dcfae170a8 100644
--- a/compiler-rt/lib/gwp_asan/options.inc
+++ b/compiler-rt/lib/gwp_asan/options.inc
@@ -10,7 +10,18 @@
#error "Define GWP_ASAN_OPTION prior to including this file!"
#endif
-GWP_ASAN_OPTION(bool, Enabled, true, "Is GWP-ASan enabled? Defaults to true.")
+#ifndef GWP_ASAN_DEFAULT_ENABLED
+#define GWP_ASAN_DEFAULT_ENABLED true
+#endif
+
+#ifndef GWP_ASAN_STRINGIFY
+#define GWP_ASAN_STRINGIFY(S) GWP_ASAN_STRINGIFY_(S)
+#define GWP_ASAN_STRINGIFY_(S) #S
+#endif
+
+GWP_ASAN_OPTION(bool, Enabled, GWP_ASAN_DEFAULT_ENABLED,
+ "Is GWP-ASan enabled? Defaults to " GWP_ASAN_STRINGIFY(
+ GWP_ASAN_DEFAULT_ENABLED) ".")
GWP_ASAN_OPTION(
bool, PerfectlyRightAlign, false,
More information about the llvm-commits
mailing list