Get rid of CPU_EASYARGS

Never use the event callbacks with mismatching prototypes.
This commit is contained in:
dhewg 2012-01-14 15:16:44 +01:00 committed by Daniel Gibson
parent 151288e170
commit 6b30d96d44
3 changed files with 0 additions and 146 deletions

View file

@ -966,15 +966,6 @@ bool idClass::ProcessEventArgPtr( const idEventDef *ev, intptr_t *data ) {
callback = c->eventMap[ num ];
#if !CPU_EASYARGS
/*
on ppc architecture, floats are passed in a seperate set of registers
the function prototypes must have matching float declaration
http://developer.apple.com/documentation/DeveloperTools/Conceptual/MachORuntime/2rt_powerpc_abi/chapter_9_section_5.html
*/
switch( ev->GetFormatspecIndex() ) {
case 1 << D_EVENT_MAXARGS :
( this->*callback )();
@ -988,62 +979,6 @@ http://developer.apple.com/documentation/DeveloperTools/Conceptual/MachORuntime/
break;
}
#else
assert( D_EVENT_MAXARGS == 8 );
switch( ev->GetNumArgs() ) {
case 0 :
( this->*callback )();
break;
case 1 :
typedef void ( idClass::*eventCallback_1_t )( const intptr_t );
( this->*( eventCallback_1_t )callback )( data[ 0 ] );
break;
case 2 :
typedef void ( idClass::*eventCallback_2_t )( const intptr_t, const intptr_t );
( this->*( eventCallback_2_t )callback )( data[ 0 ], data[ 1 ] );
break;
case 3 :
typedef void ( idClass::*eventCallback_3_t )( const intptr_t, const intptr_t, const intptr_t );
( this->*( eventCallback_3_t )callback )( data[ 0 ], data[ 1 ], data[ 2 ] );
break;
case 4 :
typedef void ( idClass::*eventCallback_4_t )( const intptr_t, const intptr_t, const intptr_t, const intptr_t );
( this->*( eventCallback_4_t )callback )( data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ] );
break;
case 5 :
typedef void ( idClass::*eventCallback_5_t )( const intptr_t, const intptr_t, const intptr_t, const intptr_t, const intptr_t );
( this->*( eventCallback_5_t )callback )( data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ] );
break;
case 6 :
typedef void ( idClass::*eventCallback_6_t )( const intptr_t, const intptr_t, const intptr_t, const intptr_t, const intptr_t, const intptr_t );
( this->*( eventCallback_6_t )callback )( data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ], data[ 5 ] );
break;
case 7 :
typedef void ( idClass::*eventCallback_7_t )( const intptr_t, const intptr_t, const intptr_t, const intptr_t, const intptr_t, const intptr_t, const intptr_t );
( this->*( eventCallback_7_t )callback )( data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ], data[ 5 ], data[ 6 ] );
break;
case 8 :
typedef void ( idClass::*eventCallback_8_t )( const intptr_t, const intptr_t, const intptr_t, const intptr_t, const intptr_t, const intptr_t, const intptr_t, const intptr_t );
( this->*( eventCallback_8_t )callback )( data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ], data[ 5 ], data[ 6 ], data[ 7 ] );
break;
default:
gameLocal.Warning( "Invalid formatspec on event '%s'", ev->GetName() );
break;
}
#endif
return true;
}

View file

@ -957,15 +957,6 @@ bool idClass::ProcessEventArgPtr( const idEventDef *ev, intptr_t *data ) {
callback = c->eventMap[ num ];
#if !CPU_EASYARGS
/*
on ppc architecture, floats are passed in a seperate set of registers
the function prototypes must have matching float declaration
http://developer.apple.com/documentation/DeveloperTools/Conceptual/MachORuntime/2rt_powerpc_abi/chapter_9_section_5.html
*/
switch( ev->GetFormatspecIndex() ) {
case 1 << D_EVENT_MAXARGS :
( this->*callback )();
@ -979,62 +970,6 @@ http://developer.apple.com/documentation/DeveloperTools/Conceptual/MachORuntime/
break;
}
#else
assert( D_EVENT_MAXARGS == 8 );
switch( ev->GetNumArgs() ) {
case 0 :
( this->*callback )();
break;
case 1 :
typedef void ( idClass::*eventCallback_1_t )( const intptr_t );
( this->*( eventCallback_1_t )callback )( data[ 0 ] );
break;
case 2 :
typedef void ( idClass::*eventCallback_2_t )( const intptr_t, const intptr_t );
( this->*( eventCallback_2_t )callback )( data[ 0 ], data[ 1 ] );
break;
case 3 :
typedef void ( idClass::*eventCallback_3_t )( const intptr_t, const intptr_t, const intptr_t );
( this->*( eventCallback_3_t )callback )( data[ 0 ], data[ 1 ], data[ 2 ] );
break;
case 4 :
typedef void ( idClass::*eventCallback_4_t )( const intptr_t, const intptr_t, const intptr_t, const intptr_t );
( this->*( eventCallback_4_t )callback )( data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ] );
break;
case 5 :
typedef void ( idClass::*eventCallback_5_t )( const intptr_t, const intptr_t, const intptr_t, const intptr_t, const intptr_t );
( this->*( eventCallback_5_t )callback )( data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ] );
break;
case 6 :
typedef void ( idClass::*eventCallback_6_t )( const intptr_t, const intptr_t, const intptr_t, const intptr_t, const intptr_t, const intptr_t );
( this->*( eventCallback_6_t )callback )( data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ], data[ 5 ] );
break;
case 7 :
typedef void ( idClass::*eventCallback_7_t )( const intptr_t, const intptr_t, const intptr_t, const intptr_t, const intptr_t, const intptr_t, const intptr_t );
( this->*( eventCallback_7_t )callback )( data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ], data[ 5 ], data[ 6 ] );
break;
case 8 :
typedef void ( idClass::*eventCallback_8_t )( const intptr_t, const intptr_t, const intptr_t, const intptr_t, const intptr_t, const intptr_t, const intptr_t, const intptr_t );
( this->*( eventCallback_8_t )callback )( data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ], data[ 5 ], data[ 6 ], data[ 7 ] );
break;
default:
gameLocal.Warning( "Invalid formatspec on event '%s'", ev->GetName() );
break;
}
#endif
return true;
}

View file

@ -44,7 +44,6 @@ If you have questions concerning this license or the applicable additional terms
#if defined(WIN32) || defined(_WIN32)
#define BUILD_OS_ID 0
#define CPU_EASYARGS 1
#define _alloca16( x ) ((void *)((((uintptr_t)_alloca( (x)+15 )) + 15) & ~15))
@ -82,11 +81,6 @@ If you have questions concerning this license or the applicable additional terms
#if defined(MACOS_X) || defined(__APPLE__)
#define BUILD_OS_ID 1
#ifdef __ppc__
#define CPU_EASYARGS 0
#elif defined(__i386__)
#define CPU_EASYARGS 1
#endif
#ifdef GAME_DLL
#define ID_GAME_API __attribute__((visibility ("default")))
@ -120,16 +114,6 @@ If you have questions concerning this license or the applicable additional terms
#define BUILD_OS_ID 2
#ifdef __i386__
#define CPU_EASYARGS 1
#elif defined(__x86_64__)
#define CPU_EASYARGS 0
#elif defined(__ppc__)
#define CPU_EASYARGS 0
#else
#error unknown cpu architecture!
#endif
#define _alloca alloca
#define _alloca16( x ) ((void *)((((uintptr_t)alloca( (x)+15 )) + 15) & ~15))