Make compiler-rt/trunk/lib/asan compileable with g++.

Patch by Timur Iskhodzhanov (timurrrr@google.com)

The double-extern thing is
http://llvm.org/bugs/show_bug.cgi?id=11869

And the #include <string[s].h> are only needed on Mac (see comments in
the original code)
and also including them might make strchr/index conflict with the g++
system headers (which don't follow the man pages, ouch!)

llvm-svn: 149129
This commit is contained in:
Alexander Potapenko 2012-01-27 10:52:37 +00:00
parent 7945c981b9
commit 13d95d5e5a
2 changed files with 9 additions and 3 deletions

View File

@ -26,8 +26,6 @@
#include <ctype.h>
#include <dlfcn.h>
#include <string.h>
#include <strings.h>
#include <pthread.h>
// To replace weak system functions on Linux we just need to declare functions
@ -44,6 +42,10 @@
// calls to our interceptors. We store pointers to system function f()
// in __asan::real_f().
#ifdef __APPLE__
// Include the declarations of the original functions.
#include <string.h>
#include <strings.h>
#include "mach_override/mach_override.h"
#define WRAPPER_NAME(x) "wrap_"#x
@ -307,7 +309,7 @@ void *WRAP(signal)(int signum, void *handler) {
}
extern "C"
extern int (sigaction)(int signum, const void *act, void *oldact);
int (sigaction)(int signum, const void *act, void *oldact);
extern "C"
int WRAP(sigaction)(int signum, const void *act, void *oldact) {

View File

@ -31,6 +31,10 @@
#endif
#endif
#if !defined(__has_feature)
#define __has_feature(x) 0
#endif
#if defined(__has_feature) && __has_feature(address_sanitizer)
# error "The AddressSanitizer run-time should not be"
" instrumented by AddressSanitizer"