llvmpipe: silence casting warnings
authorBrian Paul <brianp@vmware.com>
Thu, 13 May 2010 19:26:21 +0000 (13:26 -0600)
committerBrian Paul <brianp@vmware.com>
Thu, 13 May 2010 20:15:44 +0000 (14:15 -0600)
src/gallium/drivers/llvmpipe/lp_jit.h
src/gallium/drivers/llvmpipe/lp_setup.c
src/gallium/drivers/llvmpipe/lp_state_fs.c

index 8d06e65725f7d68e5471a38209de875e8020eb39..8dee041301936278d920cf984e796dec55a6ef82 100644 (file)
@@ -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);
 
index ddcd5c9c05afb39e6d5e3b87b5e8d876e467ce18..656e6cc38a61dea2aae5ff73b9e8c317a22ef2ee 100644 (file)
@@ -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;
index 4284efc8031b82cbbc4eb7047421a7f313ce6bda..cc163ebd4fa987bbf788f578202228c639dc4732 100644 (file)
@@ -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