[Mlir-commits] [mlir] 82ae83a - [mlir] Silence a few -Wunused-but-set-parameter warnings

Rahul Kayaith llvmlistbot at llvm.org
Wed Feb 15 08:59:22 PST 2023


Author: Rahul Kayaith
Date: 2023-02-15T11:57:31-05:00
New Revision: 82ae83a8487df0747195d1abbda11920fda11eb8

URL: https://github.com/llvm/llvm-project/commit/82ae83a8487df0747195d1abbda11920fda11eb8
DIFF: https://github.com/llvm/llvm-project/commit/82ae83a8487df0747195d1abbda11920fda11eb8.diff

LOG: [mlir] Silence a few -Wunused-but-set-parameter warnings

Some older versions of gcc hit false positives here:

/workdir/llvm-project/mlir/include/mlir/IR/Attributes.h:391:49: warning: parameter 'ty' set but not used [-Wunused-but-set-parameter]
  391 |   static inline bool isPossible(mlir::Attribute ty) {

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81676

Added: 
    

Modified: 
    mlir/include/mlir/IR/Attributes.h
    mlir/include/mlir/IR/Types.h
    mlir/include/mlir/IR/Value.h

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/IR/Attributes.h b/mlir/include/mlir/IR/Attributes.h
index 43a2abc9a73c..6f7875884029 100644
--- a/mlir/include/mlir/IR/Attributes.h
+++ b/mlir/include/mlir/IR/Attributes.h
@@ -392,6 +392,7 @@ struct CastInfo<To, From,
     /// Return a constant true instead of a dynamic true when casting to self or
     /// up the hierarchy.
     if constexpr (std::is_base_of_v<To, From>) {
+      (void)ty;
       return true;
     } else {
       return To::classof(ty);

diff  --git a/mlir/include/mlir/IR/Types.h b/mlir/include/mlir/IR/Types.h
index 9f30ce1620b4..fc377bee3cef 100644
--- a/mlir/include/mlir/IR/Types.h
+++ b/mlir/include/mlir/IR/Types.h
@@ -387,6 +387,7 @@ struct CastInfo<
     /// Return a constant true instead of a dynamic true when casting to self or
     /// up the hierarchy.
     if constexpr (std::is_base_of_v<To, From>) {
+      (void)ty;
       return true;
     } else {
       return To::classof(ty);

diff  --git a/mlir/include/mlir/IR/Value.h b/mlir/include/mlir/IR/Value.h
index e95bfcf0252d..64ced152839f 100644
--- a/mlir/include/mlir/IR/Value.h
+++ b/mlir/include/mlir/IR/Value.h
@@ -576,6 +576,7 @@ struct CastInfo<
     /// Return a constant true instead of a dynamic true when casting to self or
     /// up the hierarchy.
     if constexpr (std::is_base_of_v<To, From>) {
+      (void)ty;
       return true;
     } else {
       return To::classof(ty);


        


More information about the Mlir-commits mailing list