[compiler-rt] [compiler-rt][sanitizer_common] Fix -Wunused-template in test helpers… (PR #207706)
Aditya Medhane via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 6 04:10:28 PDT 2026
https://github.com/flash1729 created https://github.com/llvm/llvm-project/pull/207706
`Ident` is a static function template in a test header, so any test TU that never calls it trips `-Wunused-template`. Drop static.
`check_locked` in `sanitizer_mutex_test.cpp` has no callers.
Part of #202945.
>From da479e4afc600dd7b7f1035b0a7a97a0c24293a0 Mon Sep 17 00:00:00 2001
From: flash1729 <sherlockedaditya at gmail.com>
Date: Mon, 6 Jul 2026 15:37:40 +0530
Subject: [PATCH] [compiler-rt][sanitizer_common] Fix -Wunused-template in test
helpers (NFC)
Ident is a static function template in a test header, so any test TU that
never calls it trips -Wunused-template. Drop static.
check_locked in sanitizer_mutex_test.cpp has no callers. Remove it.
Part of #202945.
---
.../lib/sanitizer_common/tests/sanitizer_mutex_test.cpp | 6 ------
.../lib/sanitizer_common/tests/sanitizer_test_utils.h | 5 ++---
2 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_mutex_test.cpp b/compiler-rt/lib/sanitizer_common/tests/sanitizer_mutex_test.cpp
index 960427663480d..686dfe055c675 100644
--- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_mutex_test.cpp
+++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_mutex_test.cpp
@@ -118,12 +118,6 @@ static void *read_write_thread(void *param) {
return 0;
}
-template<typename MutexType>
-static void check_locked(MutexType *mtx) {
- GenericScopedLock<MutexType> l(mtx);
- mtx->CheckLocked();
-}
-
TEST(SanitizerCommon, SpinMutex) {
SpinMutex mtx;
mtx.Init();
diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_test_utils.h b/compiler-rt/lib/sanitizer_common/tests/sanitizer_test_utils.h
index 5fd94a0281391..9cb60c397cd75 100644
--- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_test_utils.h
+++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_test_utils.h
@@ -72,9 +72,8 @@ inline void break_optimization(void *arg) {
// This function returns its parameter but in such a way that compiler
// can not prove it.
-template<class T>
-NOINLINE
-static T Ident(T t) {
+template <class T>
+NOINLINE T Ident(T t) {
T ret = t;
break_optimization(&ret);
return ret;
More information about the llvm-commits
mailing list