[Mesa-dev] [PATCH RESEND 1/3] AMDGPU: Fix string concatenation in AMDGPUInstPrinter::printRel().

Michel Dänzer michel at daenzer.net
Wed Nov 14 03:38:57 PST 2012


From: Michel Dänzer <michel.daenzer at amd.com>

Pointed out by compiler warning:

/home/daenzer/src/llvm-git/llvm/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp:96:16: warning: adding 'int64_t' (aka 'long') to a string does not append to the string [-Wstring-plus-int]
    O << " + " + Op.getImm();
         ~~~~~~^~~~~~~~~~~~~
/home/daenzer/src/llvm-git/llvm/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp:96:16: note: use array indexing to silence this warning
    O << " + " + Op.getImm();
               ^
         &     [            ]
1 warning generated.

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---

Is this what was intended?

 lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp b/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp
index fe2032e..546aff8 100644
--- a/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp
+++ b/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp
@@ -93,7 +93,7 @@ void AMDGPUInstPrinter::printRel(const MCInst *MI, unsigned OpNo,
                                  raw_ostream &O) {
   const MCOperand &Op = MI->getOperand(OpNo);
   if (Op.getImm() != 0) {
-    O << " + " + Op.getImm();
+    O << " + " << Op.getImm();
   }
 }
 
-- 
1.7.10.4



More information about the mesa-dev mailing list