Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NFC][asan] Replace a few #if SANITIZER_APPLE with if (SANITIZER_APPLE #74173

Conversation

vitalybuka
Copy link
Collaborator

No description provided.

@llvmbot
Copy link
Collaborator

llvmbot commented Dec 2, 2023

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Vitaly Buka (vitalybuka)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/74173.diff

1 Files Affected:

  • (modified) compiler-rt/lib/asan/asan_interceptors.cpp (+3-9)
diff --git a/compiler-rt/lib/asan/asan_interceptors.cpp b/compiler-rt/lib/asan/asan_interceptors.cpp
index 7f2aecae2e3a52e..1a1a26a7cd8bf1d 100644
--- a/compiler-rt/lib/asan/asan_interceptors.cpp
+++ b/compiler-rt/lib/asan/asan_interceptors.cpp
@@ -635,10 +635,8 @@ INTERCEPTOR_STRTO_BASE(long long, __isoc23_strtoll)
 INTERCEPTOR(int, atoi, const char *nptr) {
   void *ctx;
   ASAN_INTERCEPTOR_ENTER(ctx, atoi);
-#if SANITIZER_APPLE
-  if (UNLIKELY(!AsanInited()))
+  if (SANITIZER_APPLE && UNLIKELY(!AsanInited()))
     return REAL(atoi)(nptr);
-#  endif
   ENSURE_ASAN_INITED();
   if (!flags()->replace_str) {
     return REAL(atoi)(nptr);
@@ -657,10 +655,8 @@ INTERCEPTOR(int, atoi, const char *nptr) {
 INTERCEPTOR(long, atol, const char *nptr) {
   void *ctx;
   ASAN_INTERCEPTOR_ENTER(ctx, atol);
-#if SANITIZER_APPLE
-  if (UNLIKELY(!AsanInited()))
+  if (SANITIZER_APPLE && UNLIKELY(!AsanInited()))
     return REAL(atol)(nptr);
-#  endif
   ENSURE_ASAN_INITED();
   if (!flags()->replace_str) {
     return REAL(atol)(nptr);
@@ -696,10 +692,8 @@ static void AtCxaAtexit(void *unused) {
 #if ASAN_INTERCEPT___CXA_ATEXIT
 INTERCEPTOR(int, __cxa_atexit, void (*func)(void *), void *arg,
             void *dso_handle) {
-#if SANITIZER_APPLE
-  if (UNLIKELY(!AsanInited()))
+  if (SANITIZER_APPLE && UNLIKELY(!AsanInited()))
     return REAL(__cxa_atexit)(func, arg, dso_handle);
-#    endif
   ENSURE_ASAN_INITED();
 #if CAN_SANITIZE_LEAKS
   __lsan::ScopedInterceptorDisabler disabler;

Created using spr 1.3.4

[skip ci]
Created using spr 1.3.4
Created using spr 1.3.4

[skip ci]
Created using spr 1.3.4
@vitalybuka vitalybuka changed the base branch from users/vitalybuka/spr/main.nfcasan-replace-a-few-if-sanitizer_apple-with-if-sanitizer_apple to main December 4, 2023 22:57
@vitalybuka vitalybuka merged commit b83289b into main Dec 4, 2023
5 checks passed
@vitalybuka vitalybuka deleted the users/vitalybuka/spr/nfcasan-replace-a-few-if-sanitizer_apple-with-if-sanitizer_apple branch December 4, 2023 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants