On Thu, 13 Aug 2026 03:28:43 GMT, Xin Liu <[email protected]> wrote: > This patch cleans up static template functions in headers. > > If a template function is static, C++ compilers use internal linkage. > 1. the good case: nobody in TranslationUnit(TU) uses it. We get a warning. > 2. the bad case: multiple TUs do use it. We have multiple identical copies. > 3. the worst case: if it is referenced by another inline function in a > header, we have latent ODR violation! I explain it in [the JBS > issue](https://bugs.openjdk.org/browse/JDK-8390266). > > Upstream clang has enabled > [-Wunused-template](https://github.com/llvm/llvm-project/issues/202945) under > -Wall and cleaned up their own codebase. When I build hotspot, clang emits > over 1300+ warnings from a few global headers like globalDefinitions.hpp. > > This cleanup can eliminate all warnings of -Wunused-template. I replace > static by inline. This guarantees only one copy of instantiation exists in > COMDAT section if it's necessary. only exception: I delete > c_heap_allocate_array because there's no reference. > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai).
This is a good change. Thank you. ------------- Marked as reviewed by coleenp (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/32329#pullrequestreview-4993238182
