[compiler-rt] r190411 - [ASan] Remove the explicit function prototypes for intercepted functions on Windows

Timur Iskhodzhanov timurrrr at google.com
Tue Sep 10 07:42:16 PDT 2013


Author: timurrrr
Date: Tue Sep 10 09:42:15 2013
New Revision: 190411

URL: http://llvm.org/viewvc/llvm-project?rev=190411&view=rev
Log:
[ASan] Remove the explicit function prototypes for intercepted functions on Windows

Modified:
    compiler-rt/trunk/lib/asan/asan_intercepted_functions.h
    compiler-rt/trunk/lib/interception/interception.h

Modified: compiler-rt/trunk/lib/asan/asan_intercepted_functions.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_intercepted_functions.h?rev=190411&r1=190410&r2=190411&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_intercepted_functions.h (original)
+++ compiler-rt/trunk/lib/asan/asan_intercepted_functions.h Tue Sep 10 09:42:15 2013
@@ -14,15 +14,8 @@
 #ifndef ASAN_INTERCEPTED_FUNCTIONS_H
 #define ASAN_INTERCEPTED_FUNCTIONS_H
 
-#include "asan_internal.h"
-#include "interception/interception.h"
 #include "sanitizer_common/sanitizer_platform_interceptors.h"
 
-#include <stdarg.h>
-#include <stddef.h>
-
-using __sanitizer::uptr;
-
 // Use macro to describe if specific function should be
 // intercepted on a given platform.
 #if !SANITIZER_WINDOWS
@@ -83,33 +76,4 @@ using __sanitizer::uptr;
 # define ASAN_INTERCEPT___CXA_ATEXIT 0
 #endif
 
-# if SANITIZER_WINDOWS
-extern "C" {
-// Windows threads.
-__declspec(dllimport)
-void* __stdcall CreateThread(void *sec, uptr st, void* start,
-                             void *arg, DWORD fl, DWORD *id);
-
-int memcmp(const void *a1, const void *a2, uptr size);
-void memmove(void *to, const void *from, uptr size);
-void* memset(void *block, int c, uptr size);
-void* memcpy(void *to, const void *from, uptr size);
-char* strcat(char *to, const char* from);  // NOLINT
-char* strchr(const char *str, int c);
-int strcmp(const char *s1, const char* s2);
-char* strcpy(char *to, const char* from);  // NOLINT
-uptr strlen(const char *s);
-uptr wcslen(const wchar_t *s);
-char* strncat(char *to, const char* from, uptr size);
-int strncmp(const char *s1, const char* s2, uptr size);
-char* strncpy(char *to, const char* from, uptr size);
-uptr strnlen(const char *s, uptr maxlen);
-int atoi(const char *nptr);
-long atol(const char *nptr);  // NOLINT
-long strtol(const char *nptr, char **endptr, int base);  // NOLINT
-void longjmp(void *env, int value);
-double frexp(double x, int *expptr);
-}
-# endif
-
 #endif  // ASAN_INTERCEPTED_FUNCTIONS_H

Modified: compiler-rt/trunk/lib/interception/interception.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/interception/interception.h?rev=190411&r1=190410&r2=190411&view=diff
==============================================================================
--- compiler-rt/trunk/lib/interception/interception.h (original)
+++ compiler-rt/trunk/lib/interception/interception.h Tue Sep 10 09:42:15 2013
@@ -130,7 +130,10 @@ const interpose_substitution substitutio
 #  define WRAPPER_NAME(x) "wrap_"#x
 #  define INTERCEPTOR_ATTRIBUTE
 # endif
-# define DECLARE_WRAPPER(ret_type, func, ...)
+# define DECLARE_WRAPPER(ret_type, func, ...) \
+    extern "C" ret_type func(__VA_ARGS__);
+# define DECLARE_WRAPPER_WINAPI(ret_type, func, ...) \
+    extern "C" __declspec(dllimport) ret_type __stdcall func(__VA_ARGS__);
 #else
 # define WRAP(x) __interceptor_ ## x
 # define WRAPPER_NAME(x) "__interceptor_" #x
@@ -211,7 +214,7 @@ const interpose_substitution substitutio
     namespace __interception { \
       FUNC_TYPE(func) PTR_TO_REAL(func); \
     } \
-    DECLARE_WRAPPER(ret_type, func, __VA_ARGS__) \
+    DECLARE_WRAPPER_WINAPI(ret_type, func, __VA_ARGS__) \
     extern "C" \
     INTERCEPTOR_ATTRIBUTE \
     ret_type __stdcall WRAP(func)(__VA_ARGS__)





More information about the llvm-commits mailing list