forked from OSchip/llvm-project
[ASan/Win] Eliminate a couple of FIXMEs, add NORETURN to CheckFailed/UNIMPLEMENTED
llvm-svn: 152628
This commit is contained in:
parent
ddc4c9d0a7
commit
70df757918
|
@ -38,6 +38,7 @@ extern "C" void* _ReturnAddress(void);
|
|||
# define ALIAS(x) // TODO(timurrrr): do we need this on Windows?
|
||||
# define ALIGNED(x) __declspec(align(x))
|
||||
# define NOINLINE __declspec(noinline)
|
||||
# define NORETURN __declspec(noreturn)
|
||||
|
||||
# define ASAN_INTERFACE_ATTRIBUTE // TODO(timurrrr): do we need this on Win?
|
||||
#else // defined(_WIN32)
|
||||
|
@ -46,6 +47,7 @@ extern "C" void* _ReturnAddress(void);
|
|||
# define ALIAS(x) __attribute__((alias(x)))
|
||||
# define ALIGNED(x) __attribute__((aligned(x)))
|
||||
# define NOINLINE __attribute__((noinline))
|
||||
# define NORETURN __attribute__((noreturn))
|
||||
|
||||
# define ASAN_INTERFACE_ATTRIBUTE __attribute__((visibility("default")))
|
||||
#endif // defined(_WIN32)
|
||||
|
@ -145,7 +147,7 @@ class AsanThread;
|
|||
struct AsanStackTrace;
|
||||
|
||||
// asan_rtl.cc
|
||||
void CheckFailed(const char *cond, const char *file, int line);
|
||||
void NORETURN CheckFailed(const char *cond, const char *file, int line);
|
||||
void ShowStatsAndAbort();
|
||||
|
||||
// asan_globals.cc
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include <windows.h>
|
||||
|
||||
#include <dbghelp.h>
|
||||
#include <stdio.h> // FIXME: get rid of this.
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <new> // FIXME: temporarily needed for placement new in AsanLock.
|
||||
|
@ -72,17 +71,14 @@ size_t AsanWrite(int fd, const void *buf, size_t count) {
|
|||
// code unreachable on Windows. We should clean this up.
|
||||
int AsanOpenReadonly(const char* filename) {
|
||||
UNIMPLEMENTED();
|
||||
return -1;
|
||||
}
|
||||
|
||||
size_t AsanRead(int fd, void *buf, size_t count) {
|
||||
UNIMPLEMENTED();
|
||||
return -1;
|
||||
}
|
||||
|
||||
int AsanClose(int fd) {
|
||||
UNIMPLEMENTED();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ---------------------- Stacktraces, symbols, etc. ---------------- {{{1
|
||||
|
@ -204,7 +200,6 @@ void AsanLock::Unlock() {
|
|||
// ---------------------- TSD ---------------- {{{1
|
||||
static bool tsd_key_inited = false;
|
||||
|
||||
// FIXME: is __declspec enough?
|
||||
static __declspec(thread) void *fake_tsd = NULL;
|
||||
|
||||
void AsanTSDInit(void (*destructor)(void *tsd)) {
|
||||
|
@ -240,7 +235,18 @@ int AtomicInc(int *a) {
|
|||
}
|
||||
|
||||
const char* AsanGetEnv(const char* name) {
|
||||
// FIXME: implement.
|
||||
static char env_buffer[32767] = {};
|
||||
|
||||
// Note: this implementation stores the result in a static buffer so we only
|
||||
// allow it to be called just once.
|
||||
static bool called_once = false;
|
||||
if (called_once)
|
||||
UNIMPLEMENTED();
|
||||
called_once = true;
|
||||
|
||||
DWORD rv = GetEnvironmentVariableA(name, env_buffer, sizeof(env_buffer));
|
||||
if (rv > 0 && rv < sizeof(env_buffer))
|
||||
return env_buffer;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue