Skip to content

Commit f496a0e

Browse files
committed
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
1 parent 4725583 commit f496a0e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,19 @@ void MaybeStartBackgroudThread() {
9898
}
9999

100100
# if !SANITIZER_START_BACKGROUND_THREAD_IN_ASAN_INTERNAL
101+
# ifdef __clang__
101102
# pragma clang diagnostic push
102103
// We avoid global-constructors to be sure that globals are ready when
103104
// sanitizers need them. This can happend before global constructors executed.
104105
// Here we don't mind if thread is started on later stages.
105106
# pragma clang diagnostic ignored "-Wglobal-constructors"
107+
# endif
106108
static struct BackgroudThreadStarted {
107109
BackgroudThreadStarted() { MaybeStartBackgroudThread(); }
108110
} background_thread_strarter UNUSED;
111+
# ifdef __clang__
109112
# pragma clang diagnostic pop
113+
# endif
110114
# endif
111115
#else
112116
void MaybeStartBackgroudThread() {}

0 commit comments

Comments
 (0)