Skip to content

Commit 1f0834a

Browse files
authored
[NFC][sanitizer] Use UNLIKELY in VReport/VPrintf (#104403)
1 parent 3c0a4f2 commit 1f0834a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_common.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,13 +239,15 @@ void RemoveANSIEscapeSequencesFromString(char *buffer);
239239
void Printf(const char *format, ...) FORMAT(1, 2);
240240
void Report(const char *format, ...) FORMAT(1, 2);
241241
void SetPrintfAndReportCallback(void (*callback)(const char *));
242-
#define VReport(level, ...) \
243-
do { \
244-
if ((uptr)Verbosity() >= (level)) Report(__VA_ARGS__); \
242+
#define VReport(level, ...) \
243+
do { \
244+
if (UNLIKELY((uptr)Verbosity() >= (level))) \
245+
Report(__VA_ARGS__); \
245246
} while (0)
246-
#define VPrintf(level, ...) \
247-
do { \
248-
if ((uptr)Verbosity() >= (level)) Printf(__VA_ARGS__); \
247+
#define VPrintf(level, ...) \
248+
do { \
249+
if (UNLIKELY((uptr)Verbosity() >= (level))) \
250+
Printf(__VA_ARGS__); \
249251
} while (0)
250252

251253
// Lock sanitizer error reporting and protects against nested errors.

0 commit comments

Comments
 (0)