[Mlir-commits] [mlir] f4bc315 - [mlir] Fix warnings

Kazu Hirata llvmlistbot at llvm.org
Fri Aug 15 07:24:37 PDT 2025


Author: Kazu Hirata
Date: 2025-08-15T07:24:31-07:00
New Revision: f4bc3151bb716c434a6c47c80b4e53e8f773bc85

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

LOG: [mlir] Fix warnings

This patch fixes:

  mlir/lib/Target/Wasm/TranslateFromWasm.cpp:82:1: error: unused
  variable 'wasmSectionName<(anonymous
  namespace)::WasmSectionType::DATACOUNT>'
  [-Werror,-Wunused-const-variable]

  mlir/lib/Target/Wasm/TranslateFromWasm.cpp:100:5: error: unused
  variable 'valueTypesEncodings' [-Werror,-Wunused-const-variable]

  mlir/lib/Target/Wasm/TranslateFromWasm.cpp:735:13: error: unused
  function 'buildLiteralType<unsigned int>'
  [-Werror,-Wunused-function]

  mlir/lib/Target/Wasm/TranslateFromWasm.cpp:740:13: error: unused
  function 'buildLiteralType<unsigned long>'
  [-Werror,-Wunused-function]

  mlir/lib/Target/Wasm/TranslateFromWasm.cpp:292:33: error: private
  field 'symbols' is not used [-Werror,-Wunused-private-field]

Added: 
    

Modified: 
    mlir/lib/Target/Wasm/TranslateFromWasm.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Target/Wasm/TranslateFromWasm.cpp b/mlir/lib/Target/Wasm/TranslateFromWasm.cpp
index b1c2121b54ebf..da811ba0954c2 100644
--- a/mlir/lib/Target/Wasm/TranslateFromWasm.cpp
+++ b/mlir/lib/Target/Wasm/TranslateFromWasm.cpp
@@ -78,7 +78,8 @@ constexpr const char *wasmSectionName = "";
 
 #define WASM_SEC_TRANSFORM(section)                                            \
   template <>                                                                  \
-  constexpr const char *wasmSectionName<WasmSectionType::section> = #section;
+  [[maybe_unused]] constexpr const char                                        \
+      *wasmSectionName<WasmSectionType::section> = #section;
 APPLY_WASM_SEC_TRANSFORM
 #undef WASM_SEC_TRANSFORM
 
@@ -93,11 +94,10 @@ struct ByteSequence {};
 template <std::byte Byte>
 struct UniqueByte : ByteSequence<Byte> {};
 
-constexpr ByteSequence<
+[[maybe_unused]] constexpr ByteSequence<
     WasmBinaryEncoding::Type::i32, WasmBinaryEncoding::Type::i64,
     WasmBinaryEncoding::Type::f32, WasmBinaryEncoding::Type::f64,
-    WasmBinaryEncoding::Type::v128>
-    valueTypesEncodings{};
+    WasmBinaryEncoding::Type::v128> valueTypesEncodings{};
 
 template <std::byte... allowedFlags>
 constexpr bool isValueOneOf(std::byte value,
@@ -289,7 +289,7 @@ class ExpressionParser {
 private:
   std::optional<Location> currentOpLoc;
   ParserHead &parser;
-  WasmModuleSymbolTables const &symbols;
+  [[maybe_unused]] WasmModuleSymbolTables const &symbols;
   locals_t locals;
   ValueStack valueStack;
 };
@@ -732,12 +732,12 @@ inline Type buildLiteralType<int64_t>(OpBuilder &builder) {
 }
 
 template <>
-inline Type buildLiteralType<uint32_t>(OpBuilder &builder) {
+[[maybe_unused]] inline Type buildLiteralType<uint32_t>(OpBuilder &builder) {
   return builder.getI32Type();
 }
 
 template <>
-inline Type buildLiteralType<uint64_t>(OpBuilder &builder) {
+[[maybe_unused]] inline Type buildLiteralType<uint64_t>(OpBuilder &builder) {
   return builder.getI64Type();
 }
 


        


More information about the Mlir-commits mailing list