[Mesa-dev] [PATCH mesa 1/6] glsl_to_tgsi: silence paranoid compiler's -Wclass-memaccess

Eric Engestrom eric.engestrom at intel.com
Fri Sep 21 13:50:36 UTC 2018


Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 5a7e25a274cbfced4b10..602ca4b22c05601f3902 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -2084,7 +2084,7 @@ glsl_to_tgsi_visitor::visit_expression(ir_expression* ir, st_src_reg *op)
             emit_asm(ir, TGSI_OPCODE_USHR, st_dst_reg(index_reg), offset,
                  st_src_reg_for_int(4));
             cbuf.reladdr = ralloc(mem_ctx, st_src_reg);
-            memcpy(cbuf.reladdr, &index_reg, sizeof(index_reg));
+            memcpy(static_cast<void*>(cbuf.reladdr), &index_reg, sizeof(index_reg));
          }
 
          if (const_uniform_block) {
@@ -2093,7 +2093,7 @@ glsl_to_tgsi_visitor::visit_expression(ir_expression* ir, st_src_reg *op)
          } else {
             /* Relative/variable constant buffer */
             cbuf.reladdr2 = ralloc(mem_ctx, st_src_reg);
-            memcpy(cbuf.reladdr2, &op[0], sizeof(st_src_reg));
+            memcpy(static_cast<void*>(cbuf.reladdr2), &op[0], sizeof(st_src_reg));
          }
          cbuf.has_index2 = true;
 
@@ -2804,12 +2804,12 @@ glsl_to_tgsi_visitor::visit(ir_dereference_array *ir)
 
       if (is_2D) {
          src.reladdr2 = ralloc(mem_ctx, st_src_reg);
-         memcpy(src.reladdr2, &index_reg, sizeof(index_reg));
+         memcpy(static_cast<void*>(src.reladdr2), &index_reg, sizeof(index_reg));
          src.index2D = 0;
          src.has_index2 = true;
       } else {
          src.reladdr = ralloc(mem_ctx, st_src_reg);
-         memcpy(src.reladdr, &index_reg, sizeof(index_reg));
+         memcpy(static_cast<void*>(src.reladdr), &index_reg, sizeof(index_reg));
       }
    }
 
@@ -4146,7 +4146,7 @@ glsl_to_tgsi_visitor::get_deref_offsets(ir_dereference *ir,
    unsigned location = 0;
    ir_variable *var = ir->variable_referenced();
 
-   memset(reladdr, 0, sizeof(*reladdr));
+   memset(static_cast<void*>(reladdr), 0, sizeof(*reladdr));
    reladdr->file = PROGRAM_UNDEFINED;
 
    *base = 0;
-- 
Cheers,
  Eric



More information about the mesa-dev mailing list