tsan: tidy up SCOPED_INTERCEPTOR_RAW
authorDmitry Vyukov <dvyukov@google.com>
Tue, 26 Oct 2021 14:37:11 +0000 (16:37 +0200)
committerDmitry Vyukov <dvyukov@google.com>
Wed, 27 Oct 2021 06:47:46 +0000 (08:47 +0200)
Don't leak caller_pc var from the macro
(it's not supposed to be used by interceptors).
Use UNUSED instead of (void) cast.

Depends on D112540.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D112541

compiler-rt/lib/tsan/rtl/tsan_interceptors.h

index a772854..3886a30 100644 (file)
@@ -38,12 +38,10 @@ inline bool in_symbolizer() {
 
 }  // namespace __tsan
 
-#define SCOPED_INTERCEPTOR_RAW(func, ...)      \
-  ThreadState *thr = cur_thread_init();        \
-  const uptr caller_pc = GET_CALLER_PC();      \
-  ScopedInterceptor si(thr, #func, caller_pc); \
-  const uptr pc = GET_CURRENT_PC();            \
-  (void)pc;
+#define SCOPED_INTERCEPTOR_RAW(func, ...)            \
+  ThreadState *thr = cur_thread_init();              \
+  ScopedInterceptor si(thr, #func, GET_CALLER_PC()); \
+  UNUSED const uptr pc = GET_CURRENT_PC();
 
 #define SCOPED_TSAN_INTERCEPTOR(func, ...)                                \
   SCOPED_INTERCEPTOR_RAW(func, __VA_ARGS__);                              \