diff options
| author | Alexey Samsonov <samsonov@google.com> | 2012-06-06 15:47:40 +0000 |
|---|---|---|
| committer | Alexey Samsonov <samsonov@google.com> | 2012-06-06 15:47:40 +0000 |
| commit | e95e29c2ac2a2d7eeeb7e4dae9f6afffabd0e186 (patch) | |
| tree | 97ad11f2c711e5fe091c7842250765419ded7618 | |
| parent | 00e22d2b2c6f49ea4f6601d643b36d494e51510a (diff) | |
| download | bcm5719-llvm-e95e29c2ac2a2d7eeeb7e4dae9f6afffabd0e186.tar.gz bcm5719-llvm-e95e29c2ac2a2d7eeeb7e4dae9f6afffabd0e186.zip | |
[Sanitizer] Make UNIMPLEMENTED macro common.
llvm-svn: 158077
| -rw-r--r-- | compiler-rt/lib/asan/asan_internal.h | 2 | ||||
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h | 2 | ||||
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_win.cc | 40 |
3 files changed, 16 insertions, 28 deletions
diff --git a/compiler-rt/lib/asan/asan_internal.h b/compiler-rt/lib/asan/asan_internal.h index f9794315aca..589366d30bf 100644 --- a/compiler-rt/lib/asan/asan_internal.h +++ b/compiler-rt/lib/asan/asan_internal.h @@ -223,8 +223,6 @@ void NORETURN Exit(int exitcode); void NORETURN Abort(); int Atexit(void (*function)(void)); -#define UNIMPLEMENTED() CHECK("unimplemented" && 0) - #define ASAN_ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) #if !defined(_WIN32) || defined(__clang__) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h index cddd9a81aea..6ed70523c57 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h @@ -95,4 +95,6 @@ void NORETURN CheckFailed(const char *file, int line, const char *cond, #define CHECK_GT(a, b) CHECK_IMPL((a), >, (b)) #define CHECK_GE(a, b) CHECK_IMPL((a), >=, (b)) +#define UNIMPLEMENTED() CHECK("unimplemented" && 0) + #endif // SANITIZER_DEFS_H diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_win.cc b/compiler-rt/lib/sanitizer_common/sanitizer_win.cc index 2ce9b0e38b0..09ad8a985f7 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_win.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_win.cc @@ -14,13 +14,9 @@ #ifdef _WIN32 #include <windows.h> -#include <assert.h> - #include "sanitizer_common.h" #include "sanitizer_libc.h" -#define UNIMPLEMENTED_WIN() assert(false) - namespace __sanitizer { int GetPid() { @@ -36,41 +32,36 @@ void *MmapOrDie(uptr size) { } void UnmapOrDie(void *addr, uptr size) { - // FIXME: Use CHECK here. - RAW_CHECK(VirtualFree(addr, size, MEM_DECOMMIT)); + if (VirtualFree(addr, size, MEM_DECOMMIT) == 0) { + RawWrite("Failed to unmap!\n"); + Die(); + } } void *internal_mmap(void *addr, uptr length, int prot, int flags, int fd, u64 offset) { - UNIMPLEMENTED_WIN(); - return 0; + UNIMPLEMENTED(); } int internal_munmap(void *addr, uptr length) { - UNIMPLEMENTED_WIN(); - return 0; + UNIMPLEMENTED(); } int internal_close(fd_t fd) { - UNIMPLEMENTED_WIN(); - return 0; + UNIMPLEMENTED(); } fd_t internal_open(const char *filename, bool write) { - UNIMPLEMENTED_WIN(); - return 0; + UNIMPLEMENTED(); } uptr internal_read(fd_t fd, void *buf, uptr count) { - UNIMPLEMENTED_WIN(); - return 0; + UNIMPLEMENTED(); } uptr internal_write(fd_t fd, const void *buf, uptr count) { - if (fd != 2) { - UNIMPLEMENTED_WIN(); - return 0; - } + if (fd != 2) + UNIMPLEMENTED(); HANDLE err = GetStdHandle(STD_ERROR_HANDLE); if (err == 0) return 0; // FIXME: this might not work on some apps. @@ -81,18 +72,15 @@ uptr internal_write(fd_t fd, const void *buf, uptr count) { } uptr internal_filesize(fd_t fd) { - UNIMPLEMENTED_WIN(); - return -1; + UNIMPLEMENTED(); } int internal_dup2(int oldfd, int newfd) { - UNIMPLEMENTED_WIN(); - return -1; + UNIMPLEMENTED(); } int internal_sscanf(const char *str, const char *format, ...) { - UNIMPLEMENTED_WIN(); - return -1; + UNIMPLEMENTED(); } } // namespace __sanitizer |

