Skip to content

Commit 20e78eb

Browse files
committed
[sanitizer][NFC] Fix few cpplint warnings
1 parent 19856c5 commit 20e78eb

File tree

8 files changed

+29
-21
lines changed

8 files changed

+29
-21
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4088,23 +4088,31 @@ INTERCEPTOR(int, sigfillset, __sanitizer_sigset_t *set) {
40884088
#endif
40894089

40904090
#if SANITIZER_INTERCEPT_SIGSET_LOGICOPS
4091-
INTERCEPTOR(int, sigandset, __sanitizer_sigset_t *dst, __sanitizer_sigset_t *src1, __sanitizer_sigset_t *src2) {
4091+
INTERCEPTOR(int, sigandset, __sanitizer_sigset_t *dst,
4092+
__sanitizer_sigset_t *src1, __sanitizer_sigset_t *src2) {
40924093
void *ctx;
40934094
COMMON_INTERCEPTOR_ENTER(ctx, sigandset, dst, src1, src2);
4094-
if (src1) COMMON_INTERCEPTOR_READ_RANGE(ctx, src1, sizeof(*src1));
4095-
if (src2) COMMON_INTERCEPTOR_READ_RANGE(ctx, src2, sizeof(*src2));
4095+
if (src1)
4096+
COMMON_INTERCEPTOR_READ_RANGE(ctx, src1, sizeof(*src1));
4097+
if (src2)
4098+
COMMON_INTERCEPTOR_READ_RANGE(ctx, src2, sizeof(*src2));
40964099
int res = REAL(sigandset)(dst, src1, src2);
4097-
if (!res && dst) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, dst, sizeof(*dst));
4100+
if (!res && dst)
4101+
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, dst, sizeof(*dst));
40984102
return res;
40994103
}
41004104

4101-
INTERCEPTOR(int, sigorset, __sanitizer_sigset_t *dst, __sanitizer_sigset_t *src1, __sanitizer_sigset_t *src2) {
4105+
INTERCEPTOR(int, sigorset, __sanitizer_sigset_t *dst,
4106+
__sanitizer_sigset_t *src1, __sanitizer_sigset_t *src2) {
41024107
void *ctx;
41034108
COMMON_INTERCEPTOR_ENTER(ctx, sigorset, dst, src1, src2);
4104-
if (src1) COMMON_INTERCEPTOR_READ_RANGE(ctx, src1, sizeof(*src1));
4105-
if (src2) COMMON_INTERCEPTOR_READ_RANGE(ctx, src2, sizeof(*src2));
4109+
if (src1)
4110+
COMMON_INTERCEPTOR_READ_RANGE(ctx, src1, sizeof(*src1));
4111+
if (src2)
4112+
COMMON_INTERCEPTOR_READ_RANGE(ctx, src2, sizeof(*src2));
41064113
int res = REAL(sigorset)(dst, src1, src2);
4107-
if (!res && dst) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, dst, sizeof(*dst));
4114+
if (!res && dst)
4115+
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, dst, sizeof(*dst));
41084116
return res;
41094117
}
41104118
#define INIT_SIGSET_LOGICOPS \
@@ -5897,7 +5905,7 @@ INTERCEPTOR(void, xdrrec_create, __sanitizer_XDR *xdr, unsigned sndsize,
58975905
COMMON_INTERCEPTOR_ENTER(ctx, xdrrec_create, xdr, sndsize, rcvsize,
58985906
handle, rd, wr);
58995907
COMMON_INTERCEPTOR_READ_RANGE(ctx, &xdr->x_op, sizeof xdr->x_op);
5900-
5908+
59015909
// We can't allocate a wrapper on the stack, as the handle is used outside
59025910
// this stack frame. So we put it on the heap, and keep track of it with
59035911
// the HashMap (keyed by x_private). When we later need to xdr_destroy,

compiler-rt/lib/sanitizer_common/sanitizer_flags.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ COMMON_FLAG(bool, fast_unwind_on_fatal, false,
4545
// [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92172
4646
// [2] https://bugs.llvm.org/show_bug.cgi?id=44158
4747
COMMON_FLAG(bool, fast_unwind_on_malloc,
48-
!(SANITIZER_LINUX && !SANITIZER_ANDROID && SANITIZER_ARM),
48+
!(SANITIZER_LINUX && !SANITIZER_ANDROID && SANITIZER_ARM),
4949
"If available, use the fast frame-pointer-based unwinder on "
5050
"malloc/free.")
5151
COMMON_FLAG(bool, handle_ioctl, false, "Intercept and handle ioctl requests.")

compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -503,15 +503,15 @@
503503
#define SANITIZER_INTERCEPT_MMAP64 SI_LINUX_NOT_ANDROID
504504
#define SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO \
505505
(!SI_FREEBSD && !SI_MAC && !SI_NETBSD && !SI_OPENBSD && SI_NOT_FUCHSIA && \
506-
SI_NOT_RTEMS && !SI_SOLARIS)
506+
SI_NOT_RTEMS && !SI_SOLARIS) // NOLINT
507507
#define SANITIZER_INTERCEPT_MEMALIGN \
508508
(!SI_FREEBSD && !SI_MAC && !SI_NETBSD && !SI_OPENBSD && SI_NOT_RTEMS)
509509
#define SANITIZER_INTERCEPT_PVALLOC \
510510
(!SI_FREEBSD && !SI_MAC && !SI_NETBSD && !SI_OPENBSD && SI_NOT_FUCHSIA && \
511-
SI_NOT_RTEMS && !SI_SOLARIS)
511+
SI_NOT_RTEMS && !SI_SOLARIS) // NOLINT
512512
#define SANITIZER_INTERCEPT_CFREE \
513513
(!SI_FREEBSD && !SI_MAC && !SI_NETBSD && !SI_OPENBSD && SI_NOT_FUCHSIA && \
514-
SI_NOT_RTEMS && !SI_SOLARIS)
514+
SI_NOT_RTEMS && !SI_SOLARIS) // NOLINT
515515
#define SANITIZER_INTERCEPT_REALLOCARRAY SI_POSIX
516516
#define SANITIZER_INTERCEPT_ALIGNED_ALLOC (!SI_MAC && SI_NOT_RTEMS)
517517
#define SANITIZER_INTERCEPT_MALLOC_USABLE_SIZE \

compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,14 @@ void RenderFrame(InternalScopedString *buffer, const char *format, int frame_no,
188188
case 'M':
189189
// Module basename and offset, or PC.
190190
if (address & kExternalPCBit) {
191-
} // There PCs are not meaningful.
192-
else if (info->module)
191+
// There PCs are not meaningful.
192+
} else if (info->module) {
193193
// Always strip the module name for %M.
194194
RenderModuleLocation(buffer, StripModuleName(info->module),
195195
info->module_offset, info->module_arch, "");
196-
else
196+
} else {
197197
buffer->append("(%p)", (void *)address);
198+
}
198199
break;
199200
default:
200201
Report("Unsupported specifier in stack frame format: %c (0x%zx)!\n", *p,

compiler-rt/lib/sanitizer_common/scripts/check_lint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fi
1717
# Filters
1818
# TODO: remove some of these filters
1919
COMMON_LINT_FILTER=-build/include,-build/header_guard,-legal/copyright,-whitespace/comments,-readability/casting,\
20-
-build/namespaces,-build/c++11,-runtime/int
20+
-build/namespaces,-build/c++11,-runtime/int,-runtime/references,-readability/todo
2121

2222
COMMON_LIT_TEST_LINT_FILTER=-whitespace/indent,-whitespace/line_length,-runtime/arrays,-readability/braces
2323

compiler-rt/lib/sanitizer_common/scripts/litlint.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import optparse
1111
import re
1212
import sys
13+
from io import open
1314

1415
# Compile regex once for all files
1516
runRegex = re.compile(r'(?<!-o)(?<!%run) %t\s')

compiler-rt/lib/sanitizer_common/tests/sanitizer_atomic_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
#if __has_extension(c_atomic) || __has_extension(cxx_atomic)
2020
#define ATOMIC_LLONG_LOCK_FREE __CLANG_ATOMIC_LLONG_LOCK_FREE
21-
#elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))
21+
#elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
2222
#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE
2323
#else
2424
#error Unsupported compiler.

compiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -706,9 +706,7 @@ void ReportRace(ThreadState *thr) {
706706
}
707707
#endif
708708

709-
if (!OutputReport(thr, rep))
710-
return;
711-
709+
OutputReport(thr, rep);
712710
}
713711

714712
void PrintCurrentStack(ThreadState *thr, uptr pc) {

0 commit comments

Comments
 (0)