diff options
author | Tim Angus <tim@ngus.net> | 2013-03-27 19:00:50 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-03-27 19:00:50 +0000 |
commit | 38daed324464666b5a4bb6a758c60e960b4610f0 (patch) | |
tree | e85a8d868ccc91833955be39bf35ca65485fb262 | |
parent | f68ed0529955386976608b235b26f0abe8fc87c4 (diff) |
Fix some warnings caused by lack of noreturn
-rw-r--r-- | src/cgame/cg_local.h | 4 | ||||
-rw-r--r-- | src/cgame/cg_syscalls.c | 2 | ||||
-rw-r--r-- | src/game/g_local.h | 4 | ||||
-rw-r--r-- | src/game/g_syscalls.c | 2 | ||||
-rw-r--r-- | src/qcommon/q_shared.h | 2 | ||||
-rw-r--r-- | src/qcommon/qcommon.h | 2 | ||||
-rw-r--r-- | src/renderercommon/tr_public.h | 2 | ||||
-rw-r--r-- | src/ui/ui_local.h | 2 | ||||
-rw-r--r-- | src/ui/ui_shared.h | 2 | ||||
-rw-r--r-- | src/ui/ui_syscalls.c | 2 |
10 files changed, 15 insertions, 9 deletions
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 148f3328..cf1da82d 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1542,7 +1542,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 ); int CG_PlayerCount( void ); @@ -1863,7 +1863,7 @@ const char *CG_TutorialText( void ); 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/src/cgame/cg_syscalls.c b/src/cgame/cg_syscalls.c index e3c53411..4765751d 100644 --- a/src/cgame/cg_syscalls.c +++ b/src/cgame/cg_syscalls.c @@ -51,6 +51,8 @@ void trap_Print( const char *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 ) diff --git a/src/game/g_local.h b/src/game/g_local.h index 2516e514..8e7aab8a 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -1001,7 +1001,7 @@ void G_AdminMessage( gentity_t *ent, const char *string ); void QDECL G_LogPrintf( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2))); void SendScoreboardMessageToAllClients( void ); void QDECL G_Printf( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2))); -void QDECL G_Error( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2))); +void QDECL G_Error( const char *fmt, ... ) __attribute__ ((noreturn, format (printf, 1, 2))); void G_Vote( gentity_t *ent, team_t team, qboolean voting ); void G_ExecuteVote( team_t team ); void G_CheckVote( team_t team ); @@ -1180,7 +1180,7 @@ extern vmCvar_t g_allowTeamOverlay; extern vmCvar_t g_censorship; void trap_Print( const char *fmt ); -void trap_Error( const char *fmt ); +void trap_Error( const char *fmt ) __attribute__((noreturn)); int trap_Milliseconds( void ); int trap_RealTime( qtime_t *qtime ); int trap_Argc( void ); diff --git a/src/game/g_syscalls.c b/src/game/g_syscalls.c index ea13ac2e..37236b95 100644 --- a/src/game/g_syscalls.c +++ b/src/game/g_syscalls.c @@ -49,6 +49,8 @@ void trap_Print( const char *fmt ) void trap_Error( const char *fmt ) { syscall( G_ERROR, fmt ); + // shut up GCC warning about returning functions, because we know better + exit(1); } int trap_Milliseconds( void ) diff --git a/src/qcommon/q_shared.h b/src/qcommon/q_shared.h index 816657f6..a85e3473 100644 --- a/src/qcommon/q_shared.h +++ b/src/qcommon/q_shared.h @@ -920,7 +920,7 @@ qboolean Info_Validate( const char *s ); void Info_NextPair( const char **s, char *key, char *value ); // this is only here so the functions in q_shared.c and bg_*.c can link -void QDECL Com_Error( int level, const char *error, ... ) __attribute__ ((format(printf, 2, 3))); +void QDECL Com_Error( int level, const char *error, ... ) __attribute__ ((noreturn, format(printf, 2, 3))); void QDECL Com_Printf( const char *msg, ... ) __attribute__ ((format (printf, 1, 2))); diff --git a/src/qcommon/qcommon.h b/src/qcommon/qcommon.h index 21473c0f..6f235ee9 100644 --- a/src/qcommon/qcommon.h +++ b/src/qcommon/qcommon.h @@ -794,7 +794,7 @@ void Com_BeginRedirect (char *buffer, int buffersize, void (*flush)(char *)); void Com_EndRedirect( void ); void QDECL Com_Printf( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2))); void QDECL Com_DPrintf( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2))); -void QDECL Com_Error( int code, const char *fmt, ... ) __attribute__ ((format(printf, 2, 3))); +void QDECL Com_Error( int code, const char *fmt, ... ) __attribute__ ((noreturn, format(printf, 2, 3))); void Com_Quit_f( void ) __attribute__ ((noreturn)); void Com_GameRestart(int checksumFeed, qboolean disconnect); diff --git a/src/renderercommon/tr_public.h b/src/renderercommon/tr_public.h index 2c8a144b..59ee014b 100644 --- a/src/renderercommon/tr_public.h +++ b/src/renderercommon/tr_public.h @@ -111,7 +111,7 @@ typedef struct { void (QDECL *Printf)( int printLevel, const char *fmt, ...) __attribute__ ((format (printf, 2, 3))); // abort the game - void (QDECL *Error)( int errorLevel, const char *fmt, ...) __attribute__ ((format (printf, 2, 3))); + void (QDECL *Error)( int errorLevel, const char *fmt, ...) __attribute__ ((noreturn, format (printf, 2, 3))); // milliseconds should only be used for profiling, never // for anything game related. Get time from the refdef diff --git a/src/ui/ui_local.h b/src/ui/ui_local.h index f57bc188..75b316b6 100644 --- a/src/ui/ui_local.h +++ b/src/ui/ui_local.h @@ -315,7 +315,7 @@ void UI_FillRect( float x, float y, float width, float height, const float // ui_syscalls.c // void trap_Print( const char *string ); -void trap_Error( const char *string ); +void trap_Error( const char *string ) __attribute__((noreturn)); int trap_Milliseconds( void ); void trap_Cvar_Register( vmCvar_t *vmCvar, const char *varName, const char *defaultValue, int flags ); void trap_Cvar_Update( vmCvar_t *vmCvar ); diff --git a/src/ui/ui_shared.h b/src/ui/ui_shared.h index 701fb75e..76d3bca6 100644 --- a/src/ui/ui_shared.h +++ b/src/ui/ui_shared.h @@ -431,7 +431,7 @@ typedef struct void ( *getBindingBuf )( int keynum, char *buf, int buflen ); void ( *setBinding )( int keynum, const char *binding ); void ( *executeText )( int exec_when, const char *text ); - void ( *Error )( int level, const char *error, ... ) __attribute__ ((format (printf, 2, 3))); + void ( *Error )( int level, const char *error, ... ) __attribute__ ((noreturn, format (printf, 2, 3))); void ( *Print )( const char *msg, ... ) __attribute__ ((format (printf, 1, 2))); void ( *Pause )( qboolean b ); int ( *ownerDrawWidth )( int ownerDraw, float scale ); diff --git a/src/ui/ui_syscalls.c b/src/ui/ui_syscalls.c index e59343e1..f44a749f 100644 --- a/src/ui/ui_syscalls.c +++ b/src/ui/ui_syscalls.c @@ -48,6 +48,8 @@ void trap_Print( const char *string ) void trap_Error( const char *string ) { syscall( UI_ERROR, string ); + // shut up GCC warning about returning functions, because we know better + exit(1); } int trap_Milliseconds( void ) |