[Mlir-commits] [llvm] [mlir] eliminating g++ warnings (PR #105520)

Frank Schlimbach llvmlistbot at llvm.org
Thu Aug 22 01:11:58 PDT 2024


================
@@ -1593,7 +1593,8 @@ foldTrait(Operation *, ArrayRef<Attribute>, SmallVectorImpl<OpFoldResult> &) {
 /// Given a tuple type containing a set of traits, return the result of folding
 /// the given operation.
 template <typename... Ts>
-static LogicalResult foldTraits(Operation *op, ArrayRef<Attribute> operands,
+static LogicalResult foldTraits([[maybe_unused]] Operation *op,
+                                [[maybe_unused]] ArrayRef<Attribute> operands,
----------------
fschlimb wrote:

Yes, it's the same warning (`-Wunused-but-set-parameter`) as handled in the CMakeLists.txt that you referred to. The warning triggers for gcc 11, 12, and 13 (didn't try other versions).

What's so bad about using `maybe_unused`? It works around single instance (in a very small function) of a questionable trigger of a warning. In my mind, disabling a warning for the entire project potentially does more harm.

Sure, I can disable the warning if that's preferred. I can simply adjust the version check. Let me know.


https://github.com/llvm/llvm-project/pull/105520


More information about the Mlir-commits mailing list