[Beignet] [PATCH] [PATCH]Fix compile warnings for CLANG compiler

Song, Ruiling ruiling.song at intel.com
Thu Aug 7 19:22:10 PDT 2014


I find out that the redefine warnings you fix are not warned under gcc.
In fact, it is used to disable gcc warnings on unused variable.
After apply your patch, gcc warns on the place you modified like: " warning: unused variable 'success' [-Wunused-variable]" under release version.
Any other good fix?


diff --git a/backend/src/backend/gen_encoder.cpp b/backend/src/backend/gen_encoder.cpp
index 33b6413..5053290 100644
--- a/backend/src/backend/gen_encoder.cpp
+++ b/backend/src/backend/gen_encoder.cpp
@@ -1064,7 +1064,6 @@ namespace gbe
       // this instruction.
       GenNativeInstruction *insn2 = (GenNativeInstruction *)&this->store[insnID+2];
       GBE_ASSERT(insn2->header.opcode == GEN_OPCODE_NOP);
-      insn2 = insn2;
       insn.header.opcode = GEN_OPCODE_ADD;
       this->setDst(&insn, GenRegister::ip());
       this->setSrc0(&insn, GenRegister::ip()); diff --git a/backend/src/backend/gen_reg_allocation.cpp b/backend/src/backend/gen_reg_allocation.cpp
index 7d95997..50f62b5 100644
--- a/backend/src/backend/gen_reg_allocation.cpp
+++ b/backend/src/backend/gen_reg_allocation.cpp
@@ -846,7 +846,6 @@ namespace gbe
       // from the RA map.
       bool success = expireReg(interval.reg);
       GBE_ASSERT(success);
-      success = success;
       RA.erase(interval.reg);
     }


--- a/backend/src/ir/immediate.hpp
+++ b/backend/src/ir/immediate.hpp
@@ -206,8 +206,25 @@ namespace ir {
         data.p = NULL;
       }
     }
-
+    Immediate & operator= (const Immediate &);

I checked this carefully, seems that Immediate "operator=" does not check some condition, so he set the method to private.
Others are not allowed to call this assignment operator.
You can remove the setImmediate() in backend/src/ir/context.hpp. it is not used anymore.



More information about the Beignet mailing list