From 9360baf74c9d1872fba57a29be2e358ba0bee148 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Wed, 8 Jul 2026 17:03:49 -0700 Subject: [PATCH] Fix compiler-rt/openpm with latest LLVM + `-Wunused-template` Basically cherry-pick https://github.com/llvm/llvm-project/pull/206308: [compiler-rt][sanitizer_common] Remove internal linkage from RegisterFlag (NFC) (#206308) RegisterFlag is a static function template in a header, so every TU that includes it without calling it trips `-Wunused-template`. Dropping static gives it normal external linkage and clears the warning. NFC. Part of #202945. And https://github.com/llvm/llvm-project/pull/#207983 [OpenMP] Remove internal linkage from __kmp_wait template (NFC) (#207983) __kmp_wait in kmp_dispatch.h is a static function template in a header, so any TU that includes it without instantiating it trips -Wunused-template (kmp_runtime.cpp, kmp_affinity.cpp, kmp_global.cpp, kmp_settings.cpp). It is used by kmp_dispatch.cpp and kmp_dispatch_hier.h. Drop static, which the comment above it already suggests. Part of #202945 --- .../compiler-rt/lib/sanitizer_common/sanitizer_flag_parser.h | 4 ++-- system/lib/llvm-openmp/src/kmp_dispatch.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/system/lib/compiler-rt/lib/sanitizer_common/sanitizer_flag_parser.h b/system/lib/compiler-rt/lib/sanitizer_common/sanitizer_flag_parser.h index dccdee4da2bd0..c0e2f1d8ca24f 100644 --- a/system/lib/compiler-rt/lib/sanitizer_common/sanitizer_flag_parser.h +++ b/system/lib/compiler-rt/lib/sanitizer_common/sanitizer_flag_parser.h @@ -189,8 +189,8 @@ class FlagParser { }; template -static void RegisterFlag(FlagParser *parser, const char *name, const char *desc, - T *var) { +void RegisterFlag(FlagParser *parser, const char *name, const char *desc, + T *var) { FlagHandler *fh = new (GetGlobalLowLevelAllocator()) FlagHandler(var); parser->RegisterHandler(name, fh, desc); } diff --git a/system/lib/llvm-openmp/src/kmp_dispatch.h b/system/lib/llvm-openmp/src/kmp_dispatch.h index f161a801700f4..1f45bf02c4bcb 100644 --- a/system/lib/llvm-openmp/src/kmp_dispatch.h +++ b/system/lib/llvm-openmp/src/kmp_dispatch.h @@ -291,8 +291,8 @@ template kmp_uint32 __kmp_eq(T value, T checker) { TODO: make inline function (move to header file for icl) */ template -static UT __kmp_wait(volatile UT *spinner, UT checker, - kmp_uint32 (*pred)(UT, UT) USE_ITT_BUILD_ARG(void *obj)) { +UT __kmp_wait(volatile UT *spinner, UT checker, + kmp_uint32 (*pred)(UT, UT) USE_ITT_BUILD_ARG(void *obj)) { // note: we may not belong to a team at this point volatile UT *spin = spinner; UT check = checker;