diff options
author | Alexey Samsonov <samsonov@google.com> | 2012-03-24 09:10:50 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2012-03-24 09:10:50 +0000 |
commit | 78481835ae45128a53e8360bb30668e0386afb67 (patch) | |
tree | 90ade80eb2f729cb9c0bda48c6bdb5a2482ac355 | |
parent | c8efe828a95036299782a7c8cec8dc9f6dec3561 (diff) | |
download | bcm5719-llvm-78481835ae45128a53e8360bb30668e0386afb67.tar.gz bcm5719-llvm-78481835ae45128a53e8360bb30668e0386afb67.zip |
[ASan] use ASAN_INTERCEPT_STRNLEN instead of defined(__APPLE__)
llvm-svn: 153377
-rw-r--r-- | compiler-rt/lib/asan/asan_interceptors.cc | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/compiler-rt/lib/asan/asan_interceptors.cc b/compiler-rt/lib/asan/asan_interceptors.cc index 465e787c90d..7e720d30223 100644 --- a/compiler-rt/lib/asan/asan_interceptors.cc +++ b/compiler-rt/lib/asan/asan_interceptors.cc @@ -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 @@ int strncasecmp(const char *s1, const char *s2, size_t n); 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_strlen(const char *s) { } 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 @@ INTERCEPTOR(char*, strncpy, char *to, const char *from, size_t size) { 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 @@ INTERCEPTOR(size_t, strnlen, const char *s, size_t maxlen) { } return length; } -#endif +#endif // ASAN_INTERCEPT_STRNLEN # if ASAN_INTERCEPT_STRTOLL // Returns pointer to first character of "nptr" after skipping @@ -739,7 +745,7 @@ void InitializeAsanInterceptors() { CHECK(OVERRIDE_FUNCTION(index, WRAP(strchr))); # endif #endif -#if !defined(__APPLE__) +#if ASAN_INTERCEPT_STRNLEN CHECK(INTERCEPT_FUNCTION(strnlen)); #endif |