Module: Mesa
Branch: master
Commit: 8dc8c3f5b11d5f158b0027d1501555c898e0451e
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8dc8c3f5b11d5f158b0027d1501555c898e0451e

Author: Brian Paul <[email protected]>
Date:   Wed Mar 17 08:34:23 2010 -0600

llvmpipe: silence some pointer/casting warnings

---

 src/gallium/drivers/llvmpipe/lp_state_fs.c |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c 
b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 15317ce..a403026 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -591,6 +591,20 @@ generate_blend(const struct pipe_blend_state *blend,
 }
 
 
+/** casting function to avoid compiler warnings */
+static lp_jit_frag_func
+cast_voidptr_to_lp_jit_frag_func(void *p)
+{
+   union {
+      void *v;
+      lp_jit_frag_func f;
+   } tmp;
+   assert(sizeof(tmp.v) == sizeof(tmp.f));
+   tmp.v = p;
+   return tmp.f;
+}
+
+
 /**
  * Generate the runtime callable function for the whole fragment pipeline.
  * Note that the function which we generate operates on a block of 16
@@ -851,10 +865,14 @@ generate_fragment(struct llvmpipe_context *lp,
    /*
     * Translate the LLVM IR into machine code.
     */
-   variant->jit_function[do_tri_test] = 
(lp_jit_frag_func)LLVMGetPointerToGlobal(screen->engine, function);
+   {
+      void *f = LLVMGetPointerToGlobal(screen->engine, function);
+
+      variant->jit_function[do_tri_test] = cast_voidptr_to_lp_jit_frag_func(f);
 
-   if (LP_DEBUG & DEBUG_ASM)
-      lp_disassemble(variant->jit_function[do_tri_test]);
+      if (LP_DEBUG & DEBUG_ASM)
+         lp_disassemble(f);
+   }
 }
 
 

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to