Skip to content

[compiler-rt][sanitizer_common] Fix -Wunused-template in test helpers… - #207706

Merged
vgvassilev merged 1 commit into
llvm:mainfrom
flash1729:wunused-template-sancom-tests
Jul 6, 2026
Merged

vgvassilev merged 1 commit into
llvm:mainfrom
flash1729:wunused-template-sancom-tests

Conversation

@flash1729

Copy link
Copy Markdown
Member

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.

… (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 llvm#202945.
@llvmorg-github-actions

Copy link
Copy Markdown

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Aditya Medhane (flash1729)

Changes

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 --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;

@flash1729

Copy link
Copy Markdown
Member Author

Ping for review @vitalybuka @vgvassilev

@vgvassilev vgvassilev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@vgvassilev
vgvassilev merged commit 7cb7f07 into llvm:main Jul 6, 2026
12 checks passed
@flash1729
flash1729 deleted the wunused-template-sancom-tests branch August 7, 2026 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants