[compiler-rt] f496a0e - sanitizer: use pragma clang conditionally
Martin Liska via llvm-commits
llvm-commits at lists.llvm.org
Tue May 3 02:34:38 PDT 2022
Author: Martin Liska
Date: 2022-05-03T11:34:30+02:00
New Revision: f496a0eba4f7983257069b0bb2c2fb4463106b49
URL: https://github.com/llvm/llvm-project/commit/f496a0eba4f7983257069b0bb2c2fb4463106b49
DIFF: https://github.com/llvm/llvm-project/commit/f496a0eba4f7983257069b0bb2c2fb4463106b49.diff
LOG: sanitizer: use pragma clang conditionally
Use the pragma only when __clang__ is defined.
Fixes:
sanitizer_common_libcdep.cpp:101: warning: ignoring ‘#pragma clang diagnostic’ [-Wunknown-pragmas]
Differential Revision: https://reviews.llvm.org/D124829
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp
index 6cfce8a8f2332..8fd3985642809 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp
@@ -98,15 +98,19 @@ void MaybeStartBackgroudThread() {
}
# if !SANITIZER_START_BACKGROUND_THREAD_IN_ASAN_INTERNAL
+# ifdef __clang__
# pragma clang diagnostic push
// We avoid global-constructors to be sure that globals are ready when
// sanitizers need them. This can happend before global constructors executed.
// Here we don't mind if thread is started on later stages.
# pragma clang diagnostic ignored "-Wglobal-constructors"
+# endif
static struct BackgroudThreadStarted {
BackgroudThreadStarted() { MaybeStartBackgroudThread(); }
} background_thread_strarter UNUSED;
+# ifdef __clang__
# pragma clang diagnostic pop
+# endif
# endif
#else
void MaybeStartBackgroudThread() {}
More information about the llvm-commits
mailing list