From dd859ae43d88d7e3863ef2aaaae143c18670befb Mon Sep 17 00:00:00 2001 From: Thilo Schulz Date: Mon, 18 Jul 2011 22:02:16 +0000 Subject: [PATCH] Shut up returning functions with noreturn attribute warning --- code/cgame/cg_local.h | 4 ++-- code/cgame/cg_syscalls.c | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/code/cgame/cg_local.h b/code/cgame/cg_local.h index b347bcdf..41fb5618 100644 --- a/code/cgame/cg_local.h +++ b/code/cgame/cg_local.h @@ -1193,7 +1193,7 @@ const char *CG_ConfigString( int index ); const char *CG_Argv( int arg ); void QDECL CG_Printf( const char *msg, ... ) __attribute__ ((format (printf, 1, 2))); -void QDECL CG_Error( const char *msg, ... ) __attribute__ ((format (printf, 1, 2))); +void QDECL CG_Error( const char *msg, ... ) __attribute__ ((noreturn, format (printf, 1, 2))); void CG_StartMusic( void ); @@ -1475,7 +1475,7 @@ void CG_CheckChangedPredictableEvents( playerState_t *ps ); void trap_Print( const char *fmt ); // abort the game -void trap_Error( const char *fmt ); +void trap_Error(const char *fmt) __attribute__((noreturn)); // milliseconds should only be used for performance tuning, never // for anything game related. Get time from the CG_DrawActiveFrame parameter diff --git a/code/cgame/cg_syscalls.c b/code/cgame/cg_syscalls.c index 83606acd..010be948 100644 --- a/code/cgame/cg_syscalls.c +++ b/code/cgame/cg_syscalls.c @@ -46,8 +46,11 @@ void trap_Print( const char *fmt ) { syscall( CG_PRINT, fmt ); } -void trap_Error( const char *fmt ) { - syscall( CG_ERROR, fmt ); +void trap_Error(const char *fmt) +{ + syscall(CG_ERROR, fmt); + // shut up GCC warning about returning functions, because we know better + exit(1); } int trap_Milliseconds( void ) {