Mesa (master): rtasm: fix void * / func * casting warnings
Brian Paul
brianp at kemper.freedesktop.org
Thu May 13 20:17:13 UTC 2010
Module: Mesa
Branch: master
Commit: f667526016dd1710fafd50eb09ac2c5c5b36063e
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f667526016dd1710fafd50eb09ac2c5c5b36063e
Author: Brian Paul <brianp at vmware.com>
Date: Thu May 13 13:41:49 2010 -0600
rtasm: fix void * / func * casting warnings
---
src/gallium/auxiliary/rtasm/rtasm_x86sse.c | 21 ++++++++++++++++++---
src/gallium/auxiliary/rtasm/rtasm_x86sse.h | 7 ++++++-
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/src/gallium/auxiliary/rtasm/rtasm_x86sse.c b/src/gallium/auxiliary/rtasm/rtasm_x86sse.c
index 7595214..9f70b73 100644
--- a/src/gallium/auxiliary/rtasm/rtasm_x86sse.c
+++ b/src/gallium/auxiliary/rtasm/rtasm_x86sse.c
@@ -1743,20 +1743,35 @@ void x86_release_func( struct x86_function *p )
}
-void (*x86_get_func( struct x86_function *p ))(void)
+static INLINE x86_func
+voidptr_to_x86_func(void *v)
+{
+ union {
+ void *v;
+ x86_func f;
+ } u;
+ assert(sizeof(u.v) == sizeof(u.f));
+ u.v = v;
+ return u.f;
+}
+
+
+x86_func x86_get_func( struct x86_function *p )
{
DUMP_END();
if (DISASSEM && p->store)
debug_printf("disassemble %p %p\n", p->store, p->csr);
if (p->store == p->error_overflow)
- return (void (*)(void)) NULL;
+ return voidptr_to_x86_func(NULL);
else
- return (void (*)(void)) p->store;
+ return voidptr_to_x86_func(p->store);
}
#else
+void x86sse_dummy( void );
+
void x86sse_dummy( void )
{
}
diff --git a/src/gallium/auxiliary/rtasm/rtasm_x86sse.h b/src/gallium/auxiliary/rtasm/rtasm_x86sse.h
index 319b836..6208e8f 100644
--- a/src/gallium/auxiliary/rtasm/rtasm_x86sse.h
+++ b/src/gallium/auxiliary/rtasm/rtasm_x86sse.h
@@ -102,6 +102,11 @@ enum sse_cc {
#define cc_Z cc_E
#define cc_NZ cc_NE
+
+/** generic pointer to function */
+typedef void (*x86_func)(void);
+
+
/* Begin/end/retrieve function creation:
*/
@@ -109,7 +114,7 @@ enum sse_cc {
void x86_init_func( struct x86_function *p );
void x86_init_func_size( struct x86_function *p, unsigned code_size );
void x86_release_func( struct x86_function *p );
-void (*x86_get_func( struct x86_function *p ))( void );
+x86_func x86_get_func( struct x86_function *p );
/* Debugging:
*/
More information about the mesa-commit
mailing list