[compiler-rt] [compiler-rt][sanitizer_common] Fix -Wunused-template in test helpers… (PR #207706)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 6 04:12:14 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: Aditya Medhane (flash1729)
<details>
<summary>Changes</summary>
`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.
---
Full diff: https://github.com/llvm/llvm-project/pull/207706.diff
2 Files Affected:
- (modified) compiler-rt/lib/sanitizer_common/tests/sanitizer_mutex_test.cpp (-6)
- (modified) compiler-rt/lib/sanitizer_common/tests/sanitizer_test_utils.h (+2-3)
``````````diff
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;
``````````
</details>
https://github.com/llvm/llvm-project/pull/207706
More information about the llvm-commits
mailing list