Mesa (master): llvmpipe: silence casting warnings

Brian Paul brianp at kemper.freedesktop.org
Thu May 13 20:17:13 UTC 2010


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

Author: Brian Paul <brianp at vmware.com>
Date:   Thu May 13 13:26:21 2010 -0600

llvmpipe: silence casting warnings

---

 src/gallium/drivers/llvmpipe/lp_jit.h      |   30 ++++++++++++++++++++++++++++
 src/gallium/drivers/llvmpipe/lp_setup.c    |    3 +-
 src/gallium/drivers/llvmpipe/lp_state_fs.c |   14 -------------
 3 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_jit.h b/src/gallium/drivers/llvmpipe/lp_jit.h
index 8d06e65..8dee041 100644
--- a/src/gallium/drivers/llvmpipe/lp_jit.h
+++ b/src/gallium/drivers/llvmpipe/lp_jit.h
@@ -169,6 +169,36 @@ typedef void
                     uint32_t *counter);
 
 
+/** cast wrapper to avoid compiler warnings */
+static INLINE lp_jit_frag_func
+cast_voidptr_to_lp_jit_frag_func(void *v)
+{
+   union {
+      void *v;
+      lp_jit_frag_func f;
+   } u;
+   assert(sizeof(u.v) == sizeof(u.f));
+   u.v = v;
+   return u.f;
+}
+
+
+/** cast wrapper */
+static INLINE void *
+cast_lp_jit_frag_func_to_voidptr(lp_jit_frag_func f)
+{
+   union {
+      void *v;
+      lp_jit_frag_func f;
+   } u;
+   assert(sizeof(u.v) == sizeof(u.f));
+   u.f = f;
+   return u.v;
+}
+
+
+
+
 void
 lp_jit_screen_cleanup(struct llvmpipe_screen *screen);
 
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index ddcd5c9..656e6cc 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -420,7 +420,8 @@ lp_setup_set_fs_functions( struct lp_setup_context *setup,
                            lp_jit_frag_func jit_function1,
                            boolean opaque )
 {
-   LP_DBG(DEBUG_SETUP, "%s %p\n", __FUNCTION__, (void *) jit_function0);
+   LP_DBG(DEBUG_SETUP, "%s %p\n", __FUNCTION__,
+          cast_lp_jit_frag_func_to_voidptr(jit_function0));
    /* FIXME: reference count */
 
    setup->fs.current.jit_function[0] = jit_function0;
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 4284efc..cc163eb 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -601,20 +601,6 @@ 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




More information about the mesa-commit mailing list