[flang-commits] [flang] [flang] Fix warning in build (PR #100134)

Pete Steinfeld via flang-commits flang-commits at lists.llvm.org
Tue Jul 23 07:48:48 PDT 2024


https://github.com/psteinfeld created https://github.com/llvm/llvm-project/pull/100134

After tblah's update #99817, I'm getting a warning about an unusedvariable.  It looks to me like the warning is bogus, possibly due to a bug in the compiler I'm using (GCC 9.3.0).  But adding a "maybe_unused" clause fixes it and makes my builds clean.

>From adb3ffb83e2e6c30dade9bbf23b1c71d8a41c1f6 Mon Sep 17 00:00:00 2001
From: Peter Steinfeld <psteinfeld at nvidia.com>
Date: Tue, 23 Jul 2024 07:43:59 -0700
Subject: [PATCH] After tblah's update #99817, I'm getting a warning about an
 unused variable.  It looks to me like the warning is bogus, possibly due to a
 bug in the compiler I'm using (GCC 9.3.0).  But adding a "maybe_unused"
 clause fixes it and makes my builds clean.

---
 flang/lib/Lower/DirectivesCommon.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/flang/lib/Lower/DirectivesCommon.h b/flang/lib/Lower/DirectivesCommon.h
index 5b8d1f2359c5b..24cb7c2fcf7db 100644
--- a/flang/lib/Lower/DirectivesCommon.h
+++ b/flang/lib/Lower/DirectivesCommon.h
@@ -137,7 +137,8 @@ static inline void genOmpAtomicHintAndMemoryOrderClauses(
 }
 
 template <typename AtomicListT>
-static void processOmpAtomicTODO(mlir::Type elementType, mlir::Location loc) {
+static void processOmpAtomicTODO(mlir::Type elementType,
+                                 [[maybe_unused]] mlir::Location loc) {
   if (!elementType)
     return;
   if constexpr (std::is_same<AtomicListT,



More information about the flang-commits mailing list