[flang-commits] [flang] [flang][NFC] fix build warning about unused argument (PR #164776)
via flang-commits
flang-commits at lists.llvm.org
Thu Oct 23 01:51:40 PDT 2025
https://github.com/jeanPerier created https://github.com/llvm/llvm-project/pull/164776
Fix warning:
```
flang/lib/Lower/OpenACC.cpp:819:59: warning: parameter 'loc' set but not used [-Wunused-but-set-parameter]
819 | [&](mlir::OpBuilder &modBuilder, mlir::Location loc,
| ~~~~~~~~~~~~~~~^~~
flang/lib/Lower/OpenACC.cpp:820:29: warning: parameter 'globalOp' set but not used [-Wunused-but-set-parameter]
820 | fir::GlobalOp globalOp, mlir::acc::DataClause clause,
| ~~~~~~~~~~~~~~^~~~~~~~
flang/lib/Lower/OpenACC.cpp:820:61: warning: parameter 'clause' set but not used [-Wunused-but-set-parameter]
820 | fir::GlobalOp globalOp, mlir::acc::DataClause clause,
| ~~~~~~~~~~~~~~~~~~~~~~
```
Just use [[maybe_unsued]] to deal with the fact that these arguments are not always used because of the if constexpr.
>From 9f102d69ef701a69f287678c7203e465736430ac Mon Sep 17 00:00:00 2001
From: Jean Perier <jperier at nvidia.com>
Date: Thu, 23 Oct 2025 01:47:04 -0700
Subject: [PATCH] [flang][NFC] fix build warning about unused argument
---
flang/lib/Lower/OpenACC.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/flang/lib/Lower/OpenACC.cpp b/flang/lib/Lower/OpenACC.cpp
index 1fc59c702fd81..d7861ac6463c8 100644
--- a/flang/lib/Lower/OpenACC.cpp
+++ b/flang/lib/Lower/OpenACC.cpp
@@ -816,8 +816,9 @@ static void genDeclareDataOperandOperations(
Fortran::semantics::FindCommonBlockContaining(symbol)) {
emitCommonGlobal(
converter, builder, accObject, dataClause,
- [&](mlir::OpBuilder &modBuilder, mlir::Location loc,
- fir::GlobalOp globalOp, mlir::acc::DataClause clause,
+ [&](mlir::OpBuilder &modBuilder, [[maybe_unused]] mlir::Location loc,
+ [[maybe_unused]] fir::GlobalOp globalOp,
+ [[maybe_unused]] mlir::acc::DataClause clause,
std::stringstream &asFortranStr, const std::string &ctorName) {
if constexpr (std::is_same_v<EntryOp, mlir::acc::DeclareLinkOp>) {
createDeclareGlobalOp<
More information about the flang-commits
mailing list