[llvm] r287442 - Try again to fix unused variable warning on lld-x86_64-darwin13 after r287439.

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 19 06:47:42 PST 2016


Author: dsanders
Date: Sat Nov 19 08:47:41 2016
New Revision: 287442

URL: http://llvm.org/viewvc/llvm-project?rev=287442&view=rev
Log:
Try again to fix unused variable warning on lld-x86_64-darwin13 after r287439.

The previous attempt didn't work. I assume LLVM_ATTRIBUTE_UNUSED isn't
available on that machine.


Modified:
    llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCCodeEmitter.cpp
    llvm/trunk/utils/TableGen/CodeEmitterGen.cpp

Modified: llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCCodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCCodeEmitter.cpp?rev=287442&r1=287441&r2=287442&view=diff
==============================================================================
--- llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCCodeEmitter.cpp (original)
+++ llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFMCCodeEmitter.cpp Sat Nov 19 08:47:41 2016
@@ -20,7 +20,6 @@
 #include "llvm/MC/MCSubtargetInfo.h"
 #include "llvm/MC/MCSymbol.h"
 #include "llvm/ADT/Statistic.h"
-#include "llvm/Support/Compiler.h"
 #include "llvm/Support/EndianStream.h"
 #include "llvm/Support/raw_ostream.h"
 using namespace llvm;
@@ -31,7 +30,7 @@ namespace {
 class BPFMCCodeEmitter : public MCCodeEmitter {
   BPFMCCodeEmitter(const BPFMCCodeEmitter &) = delete;
   void operator=(const BPFMCCodeEmitter &) = delete;
-  const MCInstrInfo &MCII LLVM_ATTRIBUTE_UNUSED; // Unused in NDEBUG builds.
+  const MCInstrInfo &MCII;
   const MCRegisterInfo &MRI;
   bool IsLittleEndian;
 

Modified: llvm/trunk/utils/TableGen/CodeEmitterGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeEmitterGen.cpp?rev=287442&r1=287441&r2=287442&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeEmitterGen.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeEmitterGen.cpp Sat Nov 19 08:47:41 2016
@@ -356,7 +356,8 @@ void CodeEmitterGen::run(raw_ostream &o)
     << "      RequiredFeatures[Inst.getOpcode()];\n"
     << "  if (MissingFeatures) {\n"
     << "    std::ostringstream Msg;\n"
-    << "    Msg << \"Attempting to emit \" << MCII.getName(Inst.getOpcode()).str()\n"
+    << "    Msg << \"Attempting to emit \" << "
+       "MCII.getName(Inst.getOpcode()).str()\n"
     << "        << \" instruction but the \";\n"
     << "    for (unsigned i = 0; i < 8 * sizeof(MissingFeatures); ++i)\n"
     << "      if (MissingFeatures & (1ULL << i))\n"
@@ -364,6 +365,10 @@ void CodeEmitterGen::run(raw_ostream &o)
     << "    Msg << \"predicate(s) are not met\";\n"
     << "    report_fatal_error(Msg.str());\n"
     << "  }\n"
+    << "#else\n"
+    << "// Silence unused variable warning on targets that don't use MCII for "
+       "other purposes (e.g. BPF).\n"
+    << "(void)MCII;\n"
     << "#endif // NDEBUG\n";
   o << "}\n";
   o << "#endif\n";




More information about the llvm-commits mailing list