[sanitizer][NFC] Fix few cpplint warnings

This commit is contained in:
Vitaly Buka 2020-10-13 20:38:56 -07:00
parent 19856c5982
commit 20e78eb304
8 changed files with 29 additions and 21 deletions

View File

@ -4088,23 +4088,31 @@ INTERCEPTOR(int, sigfillset, __sanitizer_sigset_t *set) {
#endif
#if SANITIZER_INTERCEPT_SIGSET_LOGICOPS
INTERCEPTOR(int, sigandset, __sanitizer_sigset_t *dst, __sanitizer_sigset_t *src1, __sanitizer_sigset_t *src2) {
INTERCEPTOR(int, sigandset, __sanitizer_sigset_t *dst,
__sanitizer_sigset_t *src1, __sanitizer_sigset_t *src2) {
void *ctx;
COMMON_INTERCEPTOR_ENTER(ctx, sigandset, dst, src1, src2);
if (src1) COMMON_INTERCEPTOR_READ_RANGE(ctx, src1, sizeof(*src1));
if (src2) COMMON_INTERCEPTOR_READ_RANGE(ctx, src2, sizeof(*src2));
if (src1)
COMMON_INTERCEPTOR_READ_RANGE(ctx, src1, sizeof(*src1));
if (src2)
COMMON_INTERCEPTOR_READ_RANGE(ctx, src2, sizeof(*src2));
int res = REAL(sigandset)(dst, src1, src2);
if (!res && dst) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, dst, sizeof(*dst));
if (!res && dst)
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, dst, sizeof(*dst));
return res;
}
INTERCEPTOR(int, sigorset, __sanitizer_sigset_t *dst, __sanitizer_sigset_t *src1, __sanitizer_sigset_t *src2) {
INTERCEPTOR(int, sigorset, __sanitizer_sigset_t *dst,
__sanitizer_sigset_t *src1, __sanitizer_sigset_t *src2) {
void *ctx;
COMMON_INTERCEPTOR_ENTER(ctx, sigorset, dst, src1, src2);
if (src1) COMMON_INTERCEPTOR_READ_RANGE(ctx, src1, sizeof(*src1));
if (src2) COMMON_INTERCEPTOR_READ_RANGE(ctx, src2, sizeof(*src2));
if (src1)
COMMON_INTERCEPTOR_READ_RANGE(ctx, src1, sizeof(*src1));
if (src2)
COMMON_INTERCEPTOR_READ_RANGE(ctx, src2, sizeof(*src2));
int res = REAL(sigorset)(dst, src1, src2);
if (!res && dst) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, dst, sizeof(*dst));
if (!res && dst)
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, dst, sizeof(*dst));
return res;
}
#define INIT_SIGSET_LOGICOPS \
@ -5897,7 +5905,7 @@ INTERCEPTOR(void, xdrrec_create, __sanitizer_XDR *xdr, unsigned sndsize,
COMMON_INTERCEPTOR_ENTER(ctx, xdrrec_create, xdr, sndsize, rcvsize,
handle, rd, wr);
COMMON_INTERCEPTOR_READ_RANGE(ctx, &xdr->x_op, sizeof xdr->x_op);
// We can't allocate a wrapper on the stack, as the handle is used outside
// this stack frame. So we put it on the heap, and keep track of it with
// the HashMap (keyed by x_private). When we later need to xdr_destroy,

View File

@ -45,7 +45,7 @@ COMMON_FLAG(bool, fast_unwind_on_fatal, false,
// [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92172
// [2] https://bugs.llvm.org/show_bug.cgi?id=44158
COMMON_FLAG(bool, fast_unwind_on_malloc,
!(SANITIZER_LINUX && !SANITIZER_ANDROID && SANITIZER_ARM),
!(SANITIZER_LINUX && !SANITIZER_ANDROID && SANITIZER_ARM),
"If available, use the fast frame-pointer-based unwinder on "
"malloc/free.")
COMMON_FLAG(bool, handle_ioctl, false, "Intercept and handle ioctl requests.")

View File

@ -503,15 +503,15 @@
#define SANITIZER_INTERCEPT_MMAP64 SI_LINUX_NOT_ANDROID
#define SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO \
(!SI_FREEBSD && !SI_MAC && !SI_NETBSD && !SI_OPENBSD && SI_NOT_FUCHSIA && \
SI_NOT_RTEMS && !SI_SOLARIS)
SI_NOT_RTEMS && !SI_SOLARIS) // NOLINT
#define SANITIZER_INTERCEPT_MEMALIGN \
(!SI_FREEBSD && !SI_MAC && !SI_NETBSD && !SI_OPENBSD && SI_NOT_RTEMS)
#define SANITIZER_INTERCEPT_PVALLOC \
(!SI_FREEBSD && !SI_MAC && !SI_NETBSD && !SI_OPENBSD && SI_NOT_FUCHSIA && \
SI_NOT_RTEMS && !SI_SOLARIS)
SI_NOT_RTEMS && !SI_SOLARIS) // NOLINT
#define SANITIZER_INTERCEPT_CFREE \
(!SI_FREEBSD && !SI_MAC && !SI_NETBSD && !SI_OPENBSD && SI_NOT_FUCHSIA && \
SI_NOT_RTEMS && !SI_SOLARIS)
SI_NOT_RTEMS && !SI_SOLARIS) // NOLINT
#define SANITIZER_INTERCEPT_REALLOCARRAY SI_POSIX
#define SANITIZER_INTERCEPT_ALIGNED_ALLOC (!SI_MAC && SI_NOT_RTEMS)
#define SANITIZER_INTERCEPT_MALLOC_USABLE_SIZE \

View File

@ -188,13 +188,14 @@ void RenderFrame(InternalScopedString *buffer, const char *format, int frame_no,
case 'M':
// Module basename and offset, or PC.
if (address & kExternalPCBit) {
} // There PCs are not meaningful.
else if (info->module)
// There PCs are not meaningful.
} else if (info->module) {
// Always strip the module name for %M.
RenderModuleLocation(buffer, StripModuleName(info->module),
info->module_offset, info->module_arch, "");
else
} else {
buffer->append("(%p)", (void *)address);
}
break;
default:
Report("Unsupported specifier in stack frame format: %c (0x%zx)!\n", *p,

View File

@ -17,7 +17,7 @@ fi
# Filters
# TODO: remove some of these filters
COMMON_LINT_FILTER=-build/include,-build/header_guard,-legal/copyright,-whitespace/comments,-readability/casting,\
-build/namespaces,-build/c++11,-runtime/int
-build/namespaces,-build/c++11,-runtime/int,-runtime/references,-readability/todo
COMMON_LIT_TEST_LINT_FILTER=-whitespace/indent,-whitespace/line_length,-runtime/arrays,-readability/braces

View File

@ -10,6 +10,7 @@
import optparse
import re
import sys
from io import open
# Compile regex once for all files
runRegex = re.compile(r'(?<!-o)(?<!%run) %t\s')

View File

@ -18,7 +18,7 @@
#if __has_extension(c_atomic) || __has_extension(cxx_atomic)
#define ATOMIC_LLONG_LOCK_FREE __CLANG_ATOMIC_LLONG_LOCK_FREE
#elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))
#elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE
#else
#error Unsupported compiler.

View File

@ -706,9 +706,7 @@ void ReportRace(ThreadState *thr) {
}
#endif
if (!OutputReport(thr, rep))
return;
OutputReport(thr, rep);
}
void PrintCurrentStack(ThreadState *thr, uptr pc) {