[compiler-rt] 20e78eb - [sanitizer][NFC] Fix few cpplint warnings
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 13 20:39:47 PDT 2020
Author: Vitaly Buka
Date: 2020-10-13T20:39:37-07:00
New Revision: 20e78eb304c4b03666f9c1c2951be9dbef265b23
URL: https://github.com/llvm/llvm-project/commit/20e78eb304c4b03666f9c1c2951be9dbef265b23
DIFF: https://github.com/llvm/llvm-project/commit/20e78eb304c4b03666f9c1c2951be9dbef265b23.diff
LOG: [sanitizer][NFC] Fix few cpplint warnings
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
compiler-rt/lib/sanitizer_common/sanitizer_flags.inc
compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp
compiler-rt/lib/sanitizer_common/scripts/check_lint.sh
compiler-rt/lib/sanitizer_common/scripts/litlint.py
compiler-rt/lib/sanitizer_common/tests/sanitizer_atomic_test.cpp
compiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
index 4ea35ae368ed..5b510781d407 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -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,
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_flags.inc b/compiler-rt/lib/sanitizer_common/sanitizer_flags.inc
index 5964c7020d31..d1412478fd2c 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_flags.inc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_flags.inc
@@ -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.")
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
index 25be06c1bc8f..37f178a6f573 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
@@ -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 \
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp
index 97755ca1c560..c998322d3944 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp
@@ -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,
diff --git a/compiler-rt/lib/sanitizer_common/scripts/check_lint.sh b/compiler-rt/lib/sanitizer_common/scripts/check_lint.sh
index 630658113f6d..4896ddba2e75 100755
--- a/compiler-rt/lib/sanitizer_common/scripts/check_lint.sh
+++ b/compiler-rt/lib/sanitizer_common/scripts/check_lint.sh
@@ -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
diff --git a/compiler-rt/lib/sanitizer_common/scripts/litlint.py b/compiler-rt/lib/sanitizer_common/scripts/litlint.py
index c443efb915a9..da6ef4bab4ee 100755
--- a/compiler-rt/lib/sanitizer_common/scripts/litlint.py
+++ b/compiler-rt/lib/sanitizer_common/scripts/litlint.py
@@ -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')
diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_atomic_test.cpp b/compiler-rt/lib/sanitizer_common/tests/sanitizer_atomic_test.cpp
index 3136886854fa..574b4f5d4e06 100644
--- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_atomic_test.cpp
+++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_atomic_test.cpp
@@ -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.
diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp b/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp
index 3354546c2a10..208d0df44df7 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp
@@ -706,9 +706,7 @@ void ReportRace(ThreadState *thr) {
}
#endif
- if (!OutputReport(thr, rep))
- return;
-
+ OutputReport(thr, rep);
}
void PrintCurrentStack(ThreadState *thr, uptr pc) {
More information about the llvm-commits
mailing list