[sanitizer] lint

llvm-svn: 172817
This commit is contained in:
Evgeniy Stepanov 2013-01-18 13:12:56 +00:00
parent 4b0ee8ecd5
commit 01671c33ff
5 changed files with 26 additions and 14 deletions

View File

@ -235,8 +235,9 @@ DECLARE_FUNCTION_AND_WRAPPER(int, vsscanf, const char *str, const char *format,
DECLARE_FUNCTION_AND_WRAPPER(int, vfscanf, void *stream, const char *format,
va_list ap);
DECLARE_FUNCTION_AND_WRAPPER(int, scanf, const char *format, ...);
DECLARE_FUNCTION_AND_WRAPPER(int, fscanf, void* stream, const char *format, ...);
DECLARE_FUNCTION_AND_WRAPPER(int, sscanf,
DECLARE_FUNCTION_AND_WRAPPER(int, fscanf,
void* stream, const char *format, ...);
DECLARE_FUNCTION_AND_WRAPPER(int, sscanf, // NOLINT
const char *str, const char *format, ...);
#if MAC_INTERPOSE_FUNCTIONS && !defined(MISSING_BLOCKS_SUPPORT)

View File

@ -86,10 +86,15 @@ void SetThreadName(const char *name) {
// ---------------------- Wrappers ---------------- {{{1
using namespace __asan; // NOLINT
#define COMMON_INTERCEPTOR_WRITE_RANGE(ctx, ptr, size) ASAN_WRITE_RANGE(ptr, size)
#define COMMON_INTERCEPTOR_WRITE_RANGE(ctx, ptr, size) \
ASAN_WRITE_RANGE(ptr, size)
#define COMMON_INTERCEPTOR_READ_RANGE(ctx, ptr, size) ASAN_READ_RANGE(ptr, size)
#define COMMON_INTERCEPTOR_ENTER(ctx, func, ...) \
do {ctx = 0; (void)ctx; ENSURE_ASAN_INITED();} while (false)
do { \
ctx = 0; \
(void)ctx; \
ENSURE_ASAN_INITED(); \
} while (false)
#define COMMON_INTERCEPTOR_FD_ACQUIRE(ctx, fd) do { } while (false)
#define COMMON_INTERCEPTOR_FD_RELEASE(ctx, fd) do { } while (false)
#define COMMON_INTERCEPTOR_SET_THREAD_NAME(ctx, name) SetThreadName(name)

View File

@ -739,10 +739,15 @@ INTERCEPTOR(int, getrusage, int who, void *usage) {
__msan_unpoison(ptr, size)
#define COMMON_INTERCEPTOR_READ_RANGE(ctx, ptr, size) do { } while (false)
#define COMMON_INTERCEPTOR_ENTER(ctx, func, ...) \
do {ctx = 0; (void)ctx; ENSURE_MSAN_INITED();} while (false)
do { \
ctx = 0; \
(void)ctx; \
ENSURE_MSAN_INITED(); \
} while (false)
#define COMMON_INTERCEPTOR_FD_ACQUIRE(ctx, fd) do { } while (false)
#define COMMON_INTERCEPTOR_FD_RELEASE(ctx, fd) do { } while (false)
#define COMMON_INTERCEPTOR_SET_THREAD_NAME(ctx, name) do { } while (false) // FIXME
#define COMMON_INTERCEPTOR_SET_THREAD_NAME(ctx, name) \
do { } while (false) // FIXME
#include "sanitizer_common/sanitizer_common_interceptors.inc"
// static

View File

@ -51,13 +51,13 @@ static void testScanf(const char *format, unsigned n, ...) {
}
TEST(SanitizerCommonInterceptors, Scanf) {
const unsigned I = sizeof(int);
const unsigned L = sizeof(long);
const unsigned LL = sizeof(long long);
const unsigned S = sizeof(short);
const unsigned C = sizeof(char);
const unsigned D = sizeof(double);
const unsigned F = sizeof(float);
const unsigned I = sizeof(int); // NOLINT
const unsigned L = sizeof(long); // NOLINT
const unsigned LL = sizeof(long long); // NOLINT
const unsigned S = sizeof(short); // NOLINT
const unsigned C = sizeof(char); // NOLINT
const unsigned D = sizeof(double); // NOLINT
const unsigned F = sizeof(float); // NOLINT
testScanf("%d", 1, I);
testScanf("%d%d%d", 3, I, I, I);

View File

@ -1611,7 +1611,8 @@ struct TsanInterceptorContext {
#define COMMON_INTERCEPTOR_ENTER(ctx, func, ...) \
SCOPED_TSAN_INTERCEPTOR(func, __VA_ARGS__) \
TsanInterceptorContext _ctx = {thr, caller_pc, pc}; \
ctx = (void*)&_ctx; (void)ctx;
ctx = (void*)&_ctx; \
(void)ctx;
#define COMMON_INTERCEPTOR_FD_ACQUIRE(ctx, fd) \
FdAcquire(((TsanInterceptorContext*)ctx)->thr, pc, fd)
#define COMMON_INTERCEPTOR_FD_RELEASE(ctx, fd) \