[llvm-commits] [compiler-rt] r153377 - /compiler-rt/trunk/lib/asan/asan_interceptors.cc

Alexey Samsonov samsonov at google.com
Sat Mar 24 02:10:50 PDT 2012


Author: samsonov
Date: Sat Mar 24 04:10:50 2012
New Revision: 153377

URL: http://llvm.org/viewvc/llvm-project?rev=153377&view=rev
Log:
[ASan] use ASAN_INTERCEPT_STRNLEN instead of defined(__APPLE__)

Modified:
    compiler-rt/trunk/lib/asan/asan_interceptors.cc

Modified: compiler-rt/trunk/lib/asan/asan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interceptors.cc?rev=153377&r1=153376&r2=153377&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_interceptors.cc Sat Mar 24 04:10:50 2012
@@ -30,7 +30,13 @@
 # define ASAN_INTERCEPT_STRTOLL 1
 #else
 # define ASAN_INTERCEPT_STRTOLL 0
-#endif  // ASAN_WINDOWS
+#endif
+
+#if !defined(__APPLE__)
+# define ASAN_INTERCEPT_STRNLEN 1
+#else
+# define ASAN_INTERCEPT_STRNLEN 0
+#endif
 
 // Use extern declarations of intercepted functions on Mac and Windows
 // to avoid including system headers.
@@ -72,7 +78,7 @@
 char* strdup(const char *s);
 # endif
 size_t strlen(const char *s);
-# if !defined(__APPLE__)
+# if ASAN_INTERCEPT_STRNLEN
 size_t strnlen(const char *s, size_t maxlen);
 # endif
 
@@ -214,7 +220,7 @@
 }
 
 size_t internal_strnlen(const char *s, size_t maxlen) {
-#ifndef __APPLE__
+#if ASAN_INTERCEPT_STRNLEN
   if (REAL(strnlen) != NULL) {
     return REAL(strnlen)(s, maxlen);
   }
@@ -637,7 +643,7 @@
   return REAL(strncpy)(to, from, size);
 }
 
-#ifndef __APPLE__
+#if ASAN_INTERCEPT_STRNLEN
 INTERCEPTOR(size_t, strnlen, const char *s, size_t maxlen) {
   ENSURE_ASAN_INITED();
   size_t length = REAL(strnlen)(s, maxlen);
@@ -646,7 +652,7 @@
   }
   return length;
 }
-#endif
+#endif  // ASAN_INTERCEPT_STRNLEN
 
 # if ASAN_INTERCEPT_STRTOLL
 // Returns pointer to first character of "nptr" after skipping
@@ -739,7 +745,7 @@
   CHECK(OVERRIDE_FUNCTION(index, WRAP(strchr)));
 # endif
 #endif
-#if !defined(__APPLE__)
+#if ASAN_INTERCEPT_STRNLEN
   CHECK(INTERCEPT_FUNCTION(strnlen));
 #endif
 





More information about the llvm-commits mailing list