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

Lv Meng meng.lv at intel.com
Tue Aug 5 20:34:23 PDT 2014


fix warnings like redefine,implict conversion. 
Signed-off-by: Lv Meng <meng.lv at intel.com>
---
 backend/src/backend/gen_encoder.cpp        |  1 -
 backend/src/backend/gen_reg_allocation.cpp |  1 -
 backend/src/backend/program.h              |  6 -----
 backend/src/ir/immediate.hpp               | 38 ++++++++++++++----------------
 src/cl_command_queue.c                     |  4 ++--
 src/cl_context.h                           |  2 +-
 src/cl_driver.h                            |  1 -
 src/cl_driver_type.h                       |  5 +++-
 src/cl_event.c                             |  1 -
 src/cl_extensions.h                        |  3 ---
 src/cl_gt_device.h                         |  1 -
 src/cl_platform_id.h                       |  3 +--
 utests/utest_helper.cpp                    |  1 -
 13 files changed, 26 insertions(+), 41 deletions(-)

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);
     }
     spilledRegs.insert(std::make_pair(interval.reg, spillTag));
diff --git a/backend/src/backend/program.h b/backend/src/backend/program.h
index 39ff402..254df92 100644
--- a/backend/src/backend/program.h
+++ b/backend/src/backend/program.h
@@ -210,12 +210,6 @@ typedef gbe_program (gbe_program_new_from_llvm_cb)(uint32_t deviceID,
                                                    int optLevel);
 extern gbe_program_new_from_llvm_cb *gbe_program_new_from_llvm;
 
-/*! create s new genprogram for link. */
-typedef gbe_program (gbe_program_new_gen_program_cb)(uint32_t deviceID,
-                                                   const void *module,
-                                                   const void *act);
-extern gbe_program_new_gen_program_cb *gbe_program_new_gen_program;
-
 /*! link the programs from llvm level. */
 typedef void (gbe_program_link_from_llvm_cb)(gbe_program dst_program,
                                              gbe_program src_program,
diff --git a/backend/src/ir/immediate.hpp b/backend/src/ir/immediate.hpp
index 6a5c819..d70a2e3 100644
--- 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 &);
   private:
+    ImmType type;  //!< Type of the value
+    uint32_t elemNum; //!< vector imm data type
+    uint64_t defaultData;
+    Immediate operator+ (const Immediate &) const;
+    Immediate operator- (const Immediate &) const;
+    Immediate operator* (const Immediate &) const;
+    Immediate operator/ (const Immediate &) const;
+    Immediate operator% (const Immediate &) const;
+    Immediate operator& (const Immediate &) const;
+    Immediate operator| (const Immediate &) const;
+    Immediate operator^ (const Immediate &) const;
+    Immediate operator<< (const Immediate &) const;
+    Immediate operator>> (const Immediate &) const;
+    static Immediate lshr (const Immediate &left, const Immediate &right);
+    void copy(const Immediate &other, int32_t offset, uint32_t num);
+    GBE_CLASS(Immediate);
+
     union {
       bool *b;
       int8_t *s8;
@@ -223,25 +240,6 @@ namespace ir {
       const Immediate *immVec[];
       void *p;
     } data;     //!< Value to store
-    ImmType type;  //!< Type of the value
-    uint32_t elemNum; //!< vector imm data type
-    uint64_t defaultData;
-    Immediate & operator= (const Immediate &);
-    Immediate operator+ (const Immediate &) const; 
-    Immediate operator- (const Immediate &) const; 
-    Immediate operator* (const Immediate &) const; 
-    Immediate operator/ (const Immediate &) const; 
-    Immediate operator% (const Immediate &) const; 
-    Immediate operator& (const Immediate &) const; 
-    Immediate operator| (const Immediate &) const; 
-    Immediate operator^ (const Immediate &) const; 
-    Immediate operator<< (const Immediate &) const; 
-    Immediate operator>> (const Immediate &) const; 
-    static Immediate lshr (const Immediate &left, const Immediate &right);
-
-
-    void copy(const Immediate &other, int32_t offset, uint32_t num);
-    GBE_CLASS(Immediate);
   };
 
   /*! Compare two immediates */
diff --git a/src/cl_command_queue.c b/src/cl_command_queue.c
index 05be801..52e91ae 100644
--- a/src/cl_command_queue.c
+++ b/src/cl_command_queue.c
@@ -141,12 +141,12 @@ cl_command_queue_bind_image(cl_command_queue queue, cl_kernel k)
     cl_gpgpu_bind_image(gpgpu, k->images[i].idx, image->base.bo, image->offset,
                         image->intel_fmt, image->image_type,
                         image->w, image->h, image->depth,
-                        image->row_pitch, image->tiling);
+                        image->row_pitch, (cl_gpgpu_tiling)image->tiling);
     if (image->image_type == CL_MEM_OBJECT_IMAGE1D_ARRAY)
       cl_gpgpu_bind_image(gpgpu, k->images[i].idx + 128, image->base.bo, image->offset,
                           image->intel_fmt, image->image_type,
                           image->w, image->h, image->depth,
-                          image->row_pitch, image->tiling);
+                          image->row_pitch, (cl_gpgpu_tiling)image->tiling);
   }
   return CL_SUCCESS;
 }
diff --git a/src/cl_context.h b/src/cl_context.h
index f8342d3..8c1e63f 100644
--- a/src/cl_context.h
+++ b/src/cl_context.h
@@ -20,9 +20,9 @@
 #ifndef __CL_CONTEXT_H__
 #define __CL_CONTEXT_H__
 
+#include "CL/cl.h"
 #include "cl_internals.h"
 #include "cl_driver.h"
-#include "CL/cl.h"
 #include "cl_khr_icd.h"
 
 #include <stdint.h>
diff --git a/src/cl_driver.h b/src/cl_driver.h
index 9cdba98..38b4830 100644
--- a/src/cl_driver.h
+++ b/src/cl_driver.h
@@ -275,7 +275,6 @@ extern cl_buffer_set_tiling_cb *cl_buffer_set_tiling;
 
 #include "cl_context.h"
 #include "cl_mem.h"
-typedef struct _cl_context *cl_context;
 
 typedef cl_buffer (cl_buffer_alloc_from_texture_cb)(cl_context, unsigned int, int, unsigned int,
                                                     struct _cl_mem_image *gl_image);
diff --git a/src/cl_driver_type.h b/src/cl_driver_type.h
index 891a33c..c39d3f1 100644
--- a/src/cl_driver_type.h
+++ b/src/cl_driver_type.h
@@ -4,6 +4,8 @@
  * will allow us to make the use of a software performance simulator easier and
  * to minimize the code specific for the HW and for the simulator
  **************************************************************************/
+#ifndef __CL_DRIVER_TYPE_H__
+#define __CL_DRIVER_TYPE_H__
 
 /* Encapsulates command buffer / data buffer / kernels */
 typedef struct _cl_buffer *cl_buffer;
@@ -21,4 +23,5 @@ typedef struct _cl_gpgpu *cl_gpgpu;
 typedef struct _cl_gpgpu_event *cl_gpgpu_event;
 
 typedef struct _cl_context_prop *cl_context_prop;
-typedef struct _cl_sampler *cl_sampler;
+
+#endif
diff --git a/src/cl_event.c b/src/cl_event.c
index 99e60eb..4f1cfbb 100644
--- a/src/cl_event.c
+++ b/src/cl_event.c
@@ -472,7 +472,6 @@ void cl_event_set_status(cl_event event, cl_int status)
     /* All user events complete, now wait enqueue events */
     ret = cl_event_wait_events(enqueue_cb->num_events, enqueue_cb->wait_list,
         enqueue_cb->event->queue);
-    ret = ret;
     assert(ret != CL_ENQUEUE_EXECUTE_DEFER);
 
     cb = enqueue_cb;
diff --git a/src/cl_extensions.h b/src/cl_extensions.h
index 52ee0a4..e6cdce8 100644
--- a/src/cl_extensions.h
+++ b/src/cl_extensions.h
@@ -92,8 +92,5 @@ typedef struct cl_extensions {
   char ext_str[256];
 } cl_extensions_t;
 
-struct _cl_platform_id;
-typedef struct _cl_platform_id * cl_platform_id;
-
 extern void
 cl_intel_platform_extension_init(cl_platform_id intel_platform);
diff --git a/src/cl_gt_device.h b/src/cl_gt_device.h
index fc8aefd..33ef1f0 100644
--- a/src/cl_gt_device.h
+++ b/src/cl_gt_device.h
@@ -51,7 +51,6 @@
 .max_samplers = 16,
 .mem_base_addr_align = sizeof(cl_long) * 16 * 8,
 .min_data_type_align_size = sizeof(cl_long) * 16,
-.single_fp_config = 0, /* XXX */
 .double_fp_config = 0,
 .global_mem_cache_type = CL_READ_WRITE_CACHE,
 .global_mem_size = 1024 * 1024 * 1024,
diff --git a/src/cl_platform_id.h b/src/cl_platform_id.h
index 2a9c07a..61b8eab 100644
--- a/src/cl_platform_id.h
+++ b/src/cl_platform_id.h
@@ -20,11 +20,10 @@
 #ifndef __CL_PLATFORM_ID_H__
 #define __CL_PLATFORM_ID_H__
 
+#include "CL/cl.h"
 #include "cl_internals.h"
 #include "cl_extensions.h"
 #include "cl_khr_icd.h"
-#include "CL/cl.h"
-
 #include "src/OCLConfig.h"
 
 struct _cl_platform_id {
diff --git a/utests/utest_helper.cpp b/utests/utest_helper.cpp
index 90cd11e..20360d0 100644
--- a/utests/utest_helper.cpp
+++ b/utests/utest_helper.cpp
@@ -537,7 +537,6 @@ int *cl_read_bmp(const char *filename, int *width, int *height)
   char magic[2];
   int ret;
   ret = fread(&magic[0], 1, 2, fp);
-  ret = ret;
   assert(2 == ret);
   assert(magic[0] == 'B' && magic[1] == 'M');
 
-- 
1.8.3.2



More information about the Beignet mailing list