Fix some compiler warnings with -pedantic
authorKeith Whitwell <keith@tungstengraphics.com>
Wed, 26 Sep 2007 12:30:01 +0000 (13:30 +0100)
committerKeith Whitwell <keith@tungstengraphics.com>
Thu, 27 Sep 2007 06:56:23 +0000 (07:56 +0100)
src/mesa/pipe/tgsi/exec/tgsi_sse2.c
src/mesa/x86/rtasm/x86sse.c
src/mesa/x86/rtasm/x86sse.h

index e7a6112..d840d64 100755 (executable)
@@ -408,7 +408,7 @@ emit_func_call1(
    struct x86_function *func,
    unsigned xmm_dst,
    unsigned storage,
-   unsigned char *code )
+   void (*code)() )
 {
    x86_push(
       func,
@@ -443,7 +443,7 @@ emit_func_call2(
    unsigned xmm_dst,
    unsigned xmm_src,
    unsigned storage,
-   unsigned char *code )
+   void (*code)() )
 {
    x86_push(
       func,
@@ -506,7 +506,7 @@ emit_cos(
       func,
       xmm_dst,
       ALIGN16( (unsigned) g_cos_storage ),
-      (unsigned char *) cos4f );
+      cos4f );
 }
 
 /* XXX: move into machine context */
@@ -538,7 +538,7 @@ emit_sin (struct x86_function *func,
       func,
       xmm_dst,
       ALIGN16( (unsigned) g_sin_storage ),
-      (unsigned char *) sin4f );
+      sin4f );
 }
 
 static void
@@ -596,7 +596,7 @@ emit_pow(
       xmm_dst,
       xmm_src,
       ALIGN16( (unsigned) g_pow_storage ),
-      (unsigned char *) pow4f );
+      pow4f );
 }
 
 /* XXX: move into machine context */
@@ -629,7 +629,7 @@ emit_ex2(
       func,
       xmm_dst,
       ALIGN16( (unsigned) g_ex2_storage ),
-      (unsigned char *) ex24f );
+      ex24f );
 }
 
 /* XXX: move into machine context */
@@ -655,7 +655,7 @@ emit_lg2(
       func,
       xmm_dst,
       ALIGN16( (unsigned) g_lg2_storage ),
-      (unsigned char *) lg24f );
+      lg24f );
 }
 
 /* XXX: move into machine context */
@@ -681,7 +681,7 @@ emit_flr(
       func,
       xmm_dst,
       ALIGN16( (unsigned) g_flr_storage ),
-      (unsigned char *) flr4f );
+      flr4f );
 }
 
 /* XXX: move into machine context */
@@ -707,7 +707,7 @@ emit_frc(
       func,
       xmm_dst,
       ALIGN16( (unsigned) g_frc_storage ),
-      (unsigned char *) frc4f );
+      frc4f );
 }
 
 static void
index 96c1301..a6cfa40 100644 (file)
@@ -6,6 +6,12 @@
 #define DISASSEM 0
 #define X86_TWOB 0x0f
 
+static GLubyte *cptr( void (*label)() )
+{
+   return (char *)(unsigned long)label;
+}
+
+
 /* Emit bytes to the instruction stream:
  */
 static void emit_1b( struct x86_function *p, GLbyte b0 )
@@ -252,10 +258,10 @@ void x86_jmp( struct x86_function *p, GLubyte *label)
    emit_1i(p, label - x86_get_label(p) - 4);
 }
 
-void x86_call( struct x86_function *p, GLubyte *label)
+void x86_call( struct x86_function *p, void (*label)())
 {
    emit_1ub(p, 0xe8);
-   emit_1i(p, label - x86_get_label(p) - 4);
+   emit_1i(p, cptr(label) - x86_get_label(p) - 4);
 }
 
 /* michal:
@@ -1138,7 +1144,7 @@ void (*x86_get_func( struct x86_function *p ))(void)
 {
    if (DISASSEM)
       _mesa_printf("disassemble %p %p\n", p->store, p->csr);
-   return (void (*)(void))p->store;
+   return (void (*)(void)) (unsigned long) p->store;
 }
 
 #else
index 4816bd2..c1ca060 100644 (file)
@@ -120,7 +120,7 @@ void x86_fixup_fwd_jump( struct x86_function *p,
 
 void x86_jmp( struct x86_function *p, GLubyte *label );
 
-void x86_call( struct x86_function *p, GLubyte *label );
+void x86_call( struct x86_function *p, void (*label)() );
 
 /* michal:
  * Temporary. As I need immediate operands, and dont want to mess with the codegen,