Suppress compiler warnings regarding unused variables
authorLei Zhang <antiagainst@google.com>
Fri, 19 Jul 2019 16:39:14 +0000 (09:39 -0700)
committerMehdi Amini <joker.eph@gmail.com>
Fri, 19 Jul 2019 18:41:34 +0000 (11:41 -0700)
Not all ops have operands or results, so it ends up there may be no
use of wordIndex or the generated op's results.

PiperOrigin-RevId: 258984485

mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp

index 869fe1a..458183f 100644 (file)
@@ -210,7 +210,7 @@ static void emitDeserializationFunction(const Record *record,
                 op.getQualCppClassName());
   os << " {\n";
   os << "  SmallVector<Type, 1> resultTypes;\n";
-  os << "  size_t wordIndex = 0;\n";
+  os << "  size_t wordIndex = 0; (void)wordIndex;\n";
 
   // Deserialize result information if it exists
   bool hasResult = false;
@@ -270,7 +270,7 @@ static void emitDeserializationFunction(const Record *record,
   }
 
   os << formatv("  auto op = opBuilder.create<{0}>(unknownLoc, resultTypes, "
-                "operands, attributes);\n",
+                "operands, attributes); (void)op;\n",
                 op.getQualCppClassName());
   if (hasResult) {
     os << "  valueMap[valueID] = op.getResult();\n";