From 6b30d96d44d746b848198f0ecccd45080c519ec8 Mon Sep 17 00:00:00 2001 From: dhewg Date: Sat, 14 Jan 2012 15:16:44 +0100 Subject: [PATCH] Get rid of CPU_EASYARGS Never use the event callbacks with mismatching prototypes. --- d3xp/gamesys/Class.cpp | 65 ------------------------------------------ game/gamesys/Class.cpp | 65 ------------------------------------------ sys/platform.h | 16 ----------- 3 files changed, 146 deletions(-) diff --git a/d3xp/gamesys/Class.cpp b/d3xp/gamesys/Class.cpp index c5e8c6e..9aeb06e 100644 --- a/d3xp/gamesys/Class.cpp +++ b/d3xp/gamesys/Class.cpp @@ -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; } diff --git a/game/gamesys/Class.cpp b/game/gamesys/Class.cpp index 9c57763..c759739 100644 --- a/game/gamesys/Class.cpp +++ b/game/gamesys/Class.cpp @@ -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; } diff --git a/sys/platform.h b/sys/platform.h index 77515d3..4998039 100644 --- a/sys/platform.h +++ b/sys/platform.h @@ -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))