[flang-commits] [flang] [Flang][#212316] Fix -Wunused-template errors under -Werror (PR #218985)
Eugene Epshteyn via flang-commits
flang-commits at lists.llvm.org
Wed Sep 2 06:06:59 PDT 2026
================
@@ -43,7 +43,7 @@ using namespace Fortran::runtime::cuda;
namespace {
template <typename OpTy>
-static bool isPinned(OpTy op) {
+[[maybe_unused]] bool isPinned(OpTy op) {
----------------
eugeneepshteyn wrote:
TL;DR: keep `static`, add `[[maybe_unused]]`. Below is a useful AI comment:
Minor, and declinable: dropping `static` does nothing here. Inside an anonymous namespace the template already has internal linkage, and the warning still fires without `static` — only the `[[maybe_unused]]` you added is doing the work:
```console
free template, anon namespace, static, unused -> warns
free template, anon namespace, NON-static, unused -> still warns
free template, anon namespace, non-static + [[maybe_unused]] -> silent
```
So the `static` removal is churn that implies a mechanism that isn't operating:
```suggestion
[[maybe_unused]] static bool isPinned(OpTy op) {
```
`isPinned` also has no callers anywhere in the tree, so deleting it is fine too — either way, the description's bullets should move this file out of the "`[[maybe_unused]]`" group, since the diff drops `static` here as well.
https://github.com/llvm/llvm-project/pull/218985
More information about the flang-commits
mailing list