[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:52:23 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-fir-hlfir
Author: None (jeanPerier)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/164776.diff
1 Files Affected:
- (modified) flang/lib/Lower/OpenACC.cpp (+3-2)
``````````diff
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<
``````````
</details>
https://github.com/llvm/llvm-project/pull/164776
More information about the flang-commits
mailing list