mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2025-01-18 23:21:39 +00:00
Bug 4812 - GCC __attribute__ annotations for printf, non-returning functions etc., patch by linux@youmustbejoking.demon.co.uk and Zack Middleton
This commit is contained in:
parent
69a7ada911
commit
9dc32d55e2
30 changed files with 63 additions and 61 deletions
4
Makefile
4
Makefile
|
@ -943,6 +943,10 @@ else
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BASE_CFLAGS += -DPRODUCT_VERSION=\\\"$(VERSION)\\\"
|
BASE_CFLAGS += -DPRODUCT_VERSION=\\\"$(VERSION)\\\"
|
||||||
|
BASE_CFLAGS += -Wformat=2 -Wno-format-zero-length -Wformat-security -Wno-format-nonliteral
|
||||||
|
BASE_CFLAGS += -Wstrict-aliasing=2 -Wmissing-format-attribute
|
||||||
|
BASE_CFLAGS += -Wdisabled-optimization
|
||||||
|
BASE_CFLAGS += -Werror-implicit-function-declaration
|
||||||
|
|
||||||
ifeq ($(V),1)
|
ifeq ($(V),1)
|
||||||
echo_cmd=@:
|
echo_cmd=@:
|
||||||
|
|
|
@ -34,7 +34,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
extern aas_t aasworld;
|
extern aas_t aasworld;
|
||||||
|
|
||||||
//AAS error message
|
//AAS error message
|
||||||
void QDECL AAS_Error(char *fmt, ...);
|
void QDECL AAS_Error(char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||||
//set AAS initialized
|
//set AAS initialized
|
||||||
void AAS_SetInitialized(void);
|
void AAS_SetInitialized(void);
|
||||||
//setup AAS with the given number of entities and clients
|
//setup AAS with the given number of entities and clients
|
||||||
|
|
|
@ -1065,7 +1065,7 @@ int AAS_ReadRouteCache(void)
|
||||||
botimport.FS_Read(&routecacheheader, sizeof(routecacheheader_t), fp );
|
botimport.FS_Read(&routecacheheader, sizeof(routecacheheader_t), fp );
|
||||||
if (routecacheheader.ident != RCID)
|
if (routecacheheader.ident != RCID)
|
||||||
{
|
{
|
||||||
AAS_Error("%s is not a route cache dump\n");
|
AAS_Error("%s is not a route cache dump\n", filename);
|
||||||
return qfalse;
|
return qfalse;
|
||||||
} //end if
|
} //end if
|
||||||
if (routecacheheader.version != RCVERSION)
|
if (routecacheheader.version != RCVERSION)
|
||||||
|
|
|
@ -698,7 +698,7 @@ bot_synonymlist_t *BotLoadSynonyms(char *filename)
|
||||||
StripDoubleQuotes(token.string);
|
StripDoubleQuotes(token.string);
|
||||||
if (strlen(token.string) <= 0)
|
if (strlen(token.string) <= 0)
|
||||||
{
|
{
|
||||||
SourceError(source, "empty string", token.string);
|
SourceError(source, "empty string");
|
||||||
FreeSource(source);
|
FreeSource(source);
|
||||||
return NULL;
|
return NULL;
|
||||||
} //end if
|
} //end if
|
||||||
|
|
|
@ -170,7 +170,7 @@ typedef struct bot_entitystate_s
|
||||||
typedef struct botlib_import_s
|
typedef struct botlib_import_s
|
||||||
{
|
{
|
||||||
//print messages from the bot library
|
//print messages from the bot library
|
||||||
void (QDECL *Print)(int type, char *fmt, ...);
|
void (QDECL *Print)(int type, char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
|
||||||
//trace a bbox through the world
|
//trace a bbox through the world
|
||||||
void (*Trace)(bsp_trace_t *trace, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int passent, int contentmask);
|
void (*Trace)(bsp_trace_t *trace, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int passent, int contentmask);
|
||||||
//trace a bbox against a specific entity
|
//trace a bbox against a specific entity
|
||||||
|
|
|
@ -36,9 +36,9 @@ void Log_Close(void);
|
||||||
//close log file if present
|
//close log file if present
|
||||||
void Log_Shutdown(void);
|
void Log_Shutdown(void);
|
||||||
//write to the current opened log file
|
//write to the current opened log file
|
||||||
void QDECL Log_Write(char *fmt, ...);
|
void QDECL Log_Write(char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||||
//write to the current opened log file with a time stamp
|
//write to the current opened log file with a time stamp
|
||||||
void QDECL Log_WriteTimeStamped(char *fmt, ...);
|
void QDECL Log_WriteTimeStamped(char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||||
//returns a pointer to the log file
|
//returns a pointer to the log file
|
||||||
FILE *Log_FilePointer(void);
|
FILE *Log_FilePointer(void);
|
||||||
//flush log file
|
//flush log file
|
||||||
|
|
|
@ -152,9 +152,9 @@ source_t *LoadSourceMemory(char *ptr, int length, char *name);
|
||||||
//free the given source
|
//free the given source
|
||||||
void FreeSource(source_t *source);
|
void FreeSource(source_t *source);
|
||||||
//print a source error
|
//print a source error
|
||||||
void QDECL SourceError(source_t *source, char *str, ...);
|
void QDECL SourceError(source_t *source, char *str, ...) __attribute__ ((format (printf, 2, 3)));
|
||||||
//print a source warning
|
//print a source warning
|
||||||
void QDECL SourceWarning(source_t *source, char *str, ...);
|
void QDECL SourceWarning(source_t *source, char *str, ...) __attribute__ ((format (printf, 2, 3)));
|
||||||
|
|
||||||
#ifdef BSPC
|
#ifdef BSPC
|
||||||
// some of BSPC source does include game/q_shared.h and some does not
|
// some of BSPC source does include game/q_shared.h and some does not
|
||||||
|
|
|
@ -990,7 +990,7 @@ int PS_ExpectTokenType(script_t *script, int type, int subtype, token_t *token)
|
||||||
if (token->subtype != subtype)
|
if (token->subtype != subtype)
|
||||||
{
|
{
|
||||||
ScriptError(script, "expected %s, found %s",
|
ScriptError(script, "expected %s, found %s",
|
||||||
script->punctuations[subtype], token->string);
|
script->punctuations[subtype].p, token->string);
|
||||||
return 0;
|
return 0;
|
||||||
} //end if
|
} //end if
|
||||||
} //end else if
|
} //end else if
|
||||||
|
@ -1158,7 +1158,7 @@ float ReadSignedFloat(script_t *script)
|
||||||
{
|
{
|
||||||
if(!PS_ExpectAnyToken(script, &token))
|
if(!PS_ExpectAnyToken(script, &token))
|
||||||
{
|
{
|
||||||
ScriptError(script, "Missing float value\n", token.string);
|
ScriptError(script, "Missing float value\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1189,7 +1189,7 @@ signed long int ReadSignedInt(script_t *script)
|
||||||
{
|
{
|
||||||
if(!PS_ExpectAnyToken(script, &token))
|
if(!PS_ExpectAnyToken(script, &token))
|
||||||
{
|
{
|
||||||
ScriptError(script, "Missing integer value\n", token.string);
|
ScriptError(script, "Missing integer value\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -240,8 +240,8 @@ void FreeScript(script_t *script);
|
||||||
//set the base folder to load files from
|
//set the base folder to load files from
|
||||||
void PS_SetBaseFolder(char *path);
|
void PS_SetBaseFolder(char *path);
|
||||||
//print a script error with filename and line number
|
//print a script error with filename and line number
|
||||||
void QDECL ScriptError(script_t *script, char *str, ...);
|
void QDECL ScriptError(script_t *script, char *str, ...) __attribute__ ((format (printf, 2, 3)));
|
||||||
//print a script warning with filename and line number
|
//print a script warning with filename and line number
|
||||||
void QDECL ScriptWarning(script_t *script, char *str, ...);
|
void QDECL ScriptWarning(script_t *script, char *str, ...) __attribute__ ((format (printf, 2, 3)));
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ qboolean ReadNumber(source_t *source, fielddef_t *fd, void *p)
|
||||||
} //end if
|
} //end if
|
||||||
if (intval < intmin || intval > intmax)
|
if (intval < intmin || intval > intmax)
|
||||||
{
|
{
|
||||||
SourceError(source, "value %d out of range [%d, %d]", intval, intmin, intmax);
|
SourceError(source, "value %ld out of range [%ld, %ld]", intval, intmin, intmax);
|
||||||
return 0;
|
return 0;
|
||||||
} //end if
|
} //end if
|
||||||
} //end if
|
} //end if
|
||||||
|
@ -160,7 +160,7 @@ qboolean ReadNumber(source_t *source, fielddef_t *fd, void *p)
|
||||||
{
|
{
|
||||||
if (intval < fd->floatmin || intval > fd->floatmax)
|
if (intval < fd->floatmin || intval > fd->floatmax)
|
||||||
{
|
{
|
||||||
SourceError(source, "value %d out of range [%f, %f]", intval, fd->floatmin, fd->floatmax);
|
SourceError(source, "value %ld out of range [%f, %f]", intval, fd->floatmin, fd->floatmax);
|
||||||
return 0;
|
return 0;
|
||||||
} //end if
|
} //end if
|
||||||
} //end if
|
} //end if
|
||||||
|
|
|
@ -1192,8 +1192,8 @@ extern vmCvar_t cg_obeliskRespawnDelay;
|
||||||
const char *CG_ConfigString( int index );
|
const char *CG_ConfigString( int index );
|
||||||
const char *CG_Argv( int arg );
|
const char *CG_Argv( int arg );
|
||||||
|
|
||||||
void QDECL CG_Printf( const char *msg, ... );
|
void QDECL CG_Printf( const char *msg, ... ) __attribute__ ((format (printf, 1, 2)));
|
||||||
void QDECL CG_Error( const char *msg, ... );
|
void QDECL CG_Error( const char *msg, ... ) __attribute__ ((format (printf, 1, 2)));
|
||||||
|
|
||||||
void CG_StartMusic( void );
|
void CG_StartMusic( void );
|
||||||
|
|
||||||
|
|
|
@ -2622,7 +2622,7 @@ void CG_ResetPlayerEntity( centity_t *cent ) {
|
||||||
cent->pe.torso.pitching = qfalse;
|
cent->pe.torso.pitching = qfalse;
|
||||||
|
|
||||||
if ( cg_debugPosition.integer ) {
|
if ( cg_debugPosition.integer ) {
|
||||||
CG_Printf("%i ResetPlayerEntity yaw=%i\n", cent->currentState.number, cent->pe.torso.yawAngle );
|
CG_Printf("%i ResetPlayerEntity yaw=%f\n", cent->currentState.number, cent->pe.torso.yawAngle );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2487,7 +2487,7 @@ Responses to broadcasts, etc
|
||||||
void CL_ConnectionlessPacket( netadr_t from, msg_t *msg ) {
|
void CL_ConnectionlessPacket( netadr_t from, msg_t *msg ) {
|
||||||
char *s;
|
char *s;
|
||||||
char *c;
|
char *c;
|
||||||
int challenge;
|
int challenge = 0;
|
||||||
|
|
||||||
MSG_BeginReadingOOB( msg );
|
MSG_BeginReadingOOB( msg );
|
||||||
MSG_ReadLong( msg ); // skip the -1
|
MSG_ReadLong( msg ); // skip the -1
|
||||||
|
@ -2968,7 +2968,7 @@ CL_RefPrintf
|
||||||
DLL glue
|
DLL glue
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void QDECL CL_RefPrintf( int print_level, const char *fmt, ...) {
|
static __attribute__ ((format (printf, 2, 3))) void QDECL CL_RefPrintf( int print_level, const char *fmt, ...) {
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
char msg[MAXPRINTMSG];
|
char msg[MAXPRINTMSG];
|
||||||
|
|
||||||
|
|
|
@ -290,7 +290,7 @@ extern float floattime;
|
||||||
#define FloatTime() floattime
|
#define FloatTime() floattime
|
||||||
|
|
||||||
// from the game source
|
// from the game source
|
||||||
void QDECL BotAI_Print(int type, char *fmt, ...);
|
void QDECL BotAI_Print(int type, char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
|
||||||
void QDECL QDECL BotAI_BotInitialChat( bot_state_t *bs, char *type, ... );
|
void QDECL QDECL BotAI_BotInitialChat( bot_state_t *bs, char *type, ... );
|
||||||
void BotAI_Trace(bsp_trace_t *bsptrace, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int passent, int contentmask);
|
void BotAI_Trace(bsp_trace_t *bsptrace, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int passent, int contentmask);
|
||||||
int BotAI_GetClientState( int clientNum, playerState_t *state );
|
int BotAI_GetClientState( int clientNum, playerState_t *state );
|
||||||
|
|
|
@ -624,10 +624,10 @@ void SetLeader(int team, int client);
|
||||||
void CheckTeamLeader( int team );
|
void CheckTeamLeader( int team );
|
||||||
void G_RunThink (gentity_t *ent);
|
void G_RunThink (gentity_t *ent);
|
||||||
void AddTournamentQueue(gclient_t *client);
|
void AddTournamentQueue(gclient_t *client);
|
||||||
void QDECL G_LogPrintf( const char *fmt, ... );
|
void QDECL G_LogPrintf( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2)));
|
||||||
void SendScoreboardMessageToAllClients( void );
|
void SendScoreboardMessageToAllClients( void );
|
||||||
void QDECL G_Printf( const char *fmt, ... );
|
void QDECL G_Printf( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2)));
|
||||||
void QDECL G_Error( const char *fmt, ... );
|
void QDECL G_Error( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2)));
|
||||||
|
|
||||||
//
|
//
|
||||||
// g_client.c
|
// g_client.c
|
||||||
|
|
|
@ -102,7 +102,7 @@ const char *TeamColorString(int team) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NULL for everyone
|
// NULL for everyone
|
||||||
void QDECL PrintMsg( gentity_t *ent, const char *fmt, ... ) {
|
static __attribute__ ((format (printf, 2, 3))) void QDECL PrintMsg( gentity_t *ent, const char *fmt, ... ) {
|
||||||
char msg[1024];
|
char msg[1024];
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
|
@ -68,7 +68,7 @@ const char * const jpeg_std_message_table[] = {
|
||||||
* or jpeg_destroy) at some point.
|
* or jpeg_destroy) at some point.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
METHODDEF(void)
|
__attribute__ ((noreturn)) METHODDEF(void)
|
||||||
error_exit (j_common_ptr cinfo)
|
error_exit (j_common_ptr cinfo)
|
||||||
{
|
{
|
||||||
/* Always display the message */
|
/* Always display the message */
|
||||||
|
|
|
@ -260,19 +260,10 @@ void QDECL Com_Error( int code, const char *fmt, ... ) {
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
static int lastErrorTime;
|
static int lastErrorTime;
|
||||||
static int errorCount;
|
static int errorCount;
|
||||||
static qboolean calledSysError = qfalse;
|
|
||||||
int currentTime;
|
int currentTime;
|
||||||
|
|
||||||
if(com_errorEntered)
|
if(com_errorEntered)
|
||||||
{
|
Sys_Error("recursive error after: %s", com_errorMessage);
|
||||||
if(!calledSysError)
|
|
||||||
{
|
|
||||||
calledSysError = qtrue;
|
|
||||||
Sys_Error("recursive error after: %s", com_errorMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
com_errorEntered = qtrue;
|
com_errorEntered = qtrue;
|
||||||
|
|
||||||
|
@ -348,7 +339,6 @@ void QDECL Com_Error( int code, const char *fmt, ... ) {
|
||||||
|
|
||||||
Com_Shutdown ();
|
Com_Shutdown ();
|
||||||
|
|
||||||
calledSysError = qtrue;
|
|
||||||
Sys_Error ("%s", com_errorMessage);
|
Sys_Error ("%s", com_errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -849,7 +849,7 @@ qboolean Info_Validate( const char *s );
|
||||||
void Info_NextPair( const char **s, char *key, char *value );
|
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
|
// 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)));
|
void QDECL Com_Printf( const char *msg, ... ) __attribute__ ((format (printf, 1, 2)));
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -821,8 +821,8 @@ void Com_BeginRedirect (char *buffer, int buffersize, void (*flush)(char *));
|
||||||
void Com_EndRedirect( void );
|
void Com_EndRedirect( void );
|
||||||
void QDECL Com_Printf( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2)));
|
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_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 );
|
void Com_Quit_f( void ) __attribute__ ((noreturn));
|
||||||
void Com_GameRestart(int checksumFeed, qboolean disconnect);
|
void Com_GameRestart(int checksumFeed, qboolean disconnect);
|
||||||
|
|
||||||
int Com_Milliseconds( void ); // will be journaled properly
|
int Com_Milliseconds( void ); // will be journaled properly
|
||||||
|
@ -1087,8 +1087,8 @@ void *Sys_GetBotLibAPI( void *parms );
|
||||||
|
|
||||||
char *Sys_GetCurrentUser( void );
|
char *Sys_GetCurrentUser( void );
|
||||||
|
|
||||||
void QDECL Sys_Error( const char *error, ...) __attribute__ ((format (printf, 1, 2)));
|
void QDECL Sys_Error( const char *error, ...) __attribute__ ((noreturn)) __attribute__ ((format (printf, 1, 2)));
|
||||||
void Sys_Quit (void);
|
void Sys_Quit (void) __attribute__ ((noreturn));
|
||||||
char *Sys_GetClipboardData( void ); // note that this isn't journaled...
|
char *Sys_GetClipboardData( void ); // note that this isn't journaled...
|
||||||
|
|
||||||
void Sys_Print( const char *msg );
|
void Sys_Print( const char *msg );
|
||||||
|
|
|
@ -229,7 +229,7 @@ static unsigned char op_argsize[256] =
|
||||||
[OP_BLOCK_COPY] = 4,
|
[OP_BLOCK_COPY] = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
void emit(const char* fmt, ...)
|
static __attribute__ ((format (printf, 1, 2))) void emit(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
char line[4096];
|
char line[4096];
|
||||||
|
@ -381,26 +381,26 @@ static void* getentrypoint(vm_t* vm)
|
||||||
return vm->codeBase;
|
return vm->codeBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CROSSCALL eop(void)
|
static __attribute__ ((noreturn)) void CROSSCALL eop(void)
|
||||||
{
|
{
|
||||||
Com_Error(ERR_DROP, "End of program reached without return!");
|
Com_Error(ERR_DROP, "End of program reached without return!");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CROSSCALL jmpviolation(void)
|
static __attribute__ ((noreturn)) void CROSSCALL jmpviolation(void)
|
||||||
{
|
{
|
||||||
Com_Error(ERR_DROP, "Program tried to execute code outside VM");
|
Com_Error(ERR_DROP, "Program tried to execute code outside VM");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_VM
|
#ifdef DEBUG_VM
|
||||||
static void CROSSCALL memviolation(void)
|
static __attribute__ ((noreturn)) void CROSSCALL memviolation(void)
|
||||||
{
|
{
|
||||||
Com_Error(ERR_DROP, "Program tried to access memory outside VM, or unaligned memory access");
|
Com_Error(ERR_DROP, "Program tried to access memory outside VM, or unaligned memory access");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CROSSCALL opstackviolation(void)
|
static __attribute__ ((noreturn)) void CROSSCALL opstackviolation(void)
|
||||||
{
|
{
|
||||||
Com_Error(ERR_DROP, "Program corrupted the VM opStack");
|
Com_Error(ERR_DROP, "Program corrupted the VM opStack");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
@ -30,6 +30,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
// Ignore __attribute__ on non-gcc platforms
|
||||||
|
#ifndef __GNUC__
|
||||||
|
#ifndef __attribute__
|
||||||
|
#define __attribute__(x)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef uint8_t u8;
|
typedef uint8_t u8;
|
||||||
typedef uint16_t u16;
|
typedef uint16_t u16;
|
||||||
typedef uint32_t u32;
|
typedef uint32_t u32;
|
||||||
|
@ -55,7 +62,7 @@ static FILE* fout;
|
||||||
#define debug(fmt, args...)
|
#define debug(fmt, args...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void _crap(const char* func, const char* fmt, ...)
|
static __attribute__ ((noreturn)) __attribute__ ((format (printf, 2, 3))) void _crap(const char* func, const char* fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
fprintf(stderr, "%s() - ", func);
|
fprintf(stderr, "%s() - ", func);
|
||||||
|
|
|
@ -106,10 +106,10 @@ typedef struct {
|
||||||
//
|
//
|
||||||
typedef struct {
|
typedef struct {
|
||||||
// print message on the local console
|
// print message on the local console
|
||||||
void (QDECL *Printf)( int printLevel, const char *fmt, ...);
|
void (QDECL *Printf)( int printLevel, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
|
||||||
|
|
||||||
// abort the game
|
// abort the game
|
||||||
void (QDECL *Error)( int errorLevel, const char *fmt, ...);
|
void (QDECL *Error)( int errorLevel, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
|
||||||
|
|
||||||
// milliseconds should only be used for profiling, never
|
// milliseconds should only be used for profiling, never
|
||||||
// for anything game related. Get time from the refdef
|
// for anything game related. Get time from the refdef
|
||||||
|
|
|
@ -310,7 +310,7 @@ extern cvar_t *sv_voip;
|
||||||
// sv_main.c
|
// sv_main.c
|
||||||
//
|
//
|
||||||
void SV_FinalMessage (char *message);
|
void SV_FinalMessage (char *message);
|
||||||
void QDECL SV_SendServerCommand( client_t *cl, const char *fmt, ...);
|
void QDECL SV_SendServerCommand( client_t *cl, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
|
||||||
|
|
||||||
|
|
||||||
void SV_AddOperatorCommands (void);
|
void SV_AddOperatorCommands (void);
|
||||||
|
|
|
@ -133,7 +133,7 @@ void BotDrawDebugPolygons(void (*drawPoly)(int color, int numPoints, float *poin
|
||||||
BotImport_Print
|
BotImport_Print
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static void QDECL BotImport_Print(int type, char *fmt, ...)
|
static __attribute__ ((format (printf, 2, 3))) void QDECL BotImport_Print(int type, char *fmt, ...)
|
||||||
{
|
{
|
||||||
char str[2048];
|
char str[2048];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
|
@ -68,7 +68,7 @@ static void SV_RankEncodeGameID( uint64_t game_id, char* result,
|
||||||
static uint64_t SV_RankDecodePlayerID( const char* string );
|
static uint64_t SV_RankDecodePlayerID( const char* string );
|
||||||
static void SV_RankDecodePlayerKey( const char* string, GR_PLAYER_TOKEN key );
|
static void SV_RankDecodePlayerKey( const char* string, GR_PLAYER_TOKEN key );
|
||||||
static char* SV_RankStatusString( GR_STATUS status );
|
static char* SV_RankStatusString( GR_STATUS status );
|
||||||
static void SV_RankError( const char* fmt, ... );
|
static void SV_RankError( const char* fmt, ... ) __attribute__ ((format (printf, 1, 2)));
|
||||||
static char SV_RankGameKey[64];
|
static char SV_RankGameKey[64];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -52,7 +52,7 @@ void Sys_GLimpSafeInit( void );
|
||||||
void Sys_GLimpInit( void );
|
void Sys_GLimpInit( void );
|
||||||
void Sys_PlatformInit( void );
|
void Sys_PlatformInit( void );
|
||||||
void Sys_PlatformExit( void );
|
void Sys_PlatformExit( void );
|
||||||
void Sys_SigHandler( int signal );
|
void Sys_SigHandler( int signal ) __attribute__ ((noreturn));
|
||||||
void Sys_ErrorDialog( const char *error );
|
void Sys_ErrorDialog( const char *error );
|
||||||
void Sys_AnsiColorPrint( const char *msg );
|
void Sys_AnsiColorPrint( const char *msg );
|
||||||
|
|
||||||
|
|
|
@ -193,7 +193,7 @@ Sys_Exit
|
||||||
Single exit point (regular exit or in case of error)
|
Single exit point (regular exit or in case of error)
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void Sys_Exit( int exitCode )
|
static __attribute__ ((noreturn)) void Sys_Exit( int exitCode )
|
||||||
{
|
{
|
||||||
CON_Shutdown( );
|
CON_Shutdown( );
|
||||||
|
|
||||||
|
@ -351,18 +351,18 @@ void Sys_Error( const char *error, ... )
|
||||||
Q_vsnprintf (string, sizeof(string), error, argptr);
|
Q_vsnprintf (string, sizeof(string), error, argptr);
|
||||||
va_end (argptr);
|
va_end (argptr);
|
||||||
|
|
||||||
CL_Shutdown(string, qtrue);
|
|
||||||
Sys_ErrorDialog( string );
|
Sys_ErrorDialog( string );
|
||||||
|
|
||||||
Sys_Exit( 3 );
|
Sys_Exit( 3 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
Sys_Warn
|
Sys_Warn
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void Sys_Warn( char *warning, ... )
|
static __attribute__ ((format (printf, 1, 2))) void Sys_Warn( char *warning, ... )
|
||||||
{
|
{
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
char string[1024];
|
char string[1024];
|
||||||
|
@ -373,6 +373,7 @@ void Sys_Warn( char *warning, ... )
|
||||||
|
|
||||||
CON_Print( va( "Warning: %s", string ) );
|
CON_Print( va( "Warning: %s", string ) );
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
============
|
============
|
||||||
|
|
|
@ -251,7 +251,7 @@ void String_Init(void) {
|
||||||
PC_SourceWarning
|
PC_SourceWarning
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void PC_SourceWarning(int handle, char *format, ...) {
|
static __attribute__ ((format (printf, 2, 3))) void PC_SourceWarning(int handle, char *format, ...) {
|
||||||
int line;
|
int line;
|
||||||
char filename[128];
|
char filename[128];
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
|
@ -273,7 +273,7 @@ void PC_SourceWarning(int handle, char *format, ...) {
|
||||||
PC_SourceError
|
PC_SourceError
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void PC_SourceError(int handle, char *format, ...) {
|
static __attribute__ ((format (printf, 2, 3))) void PC_SourceError(int handle, char *format, ...) {
|
||||||
int line;
|
int line;
|
||||||
char filename[128];
|
char filename[128];
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
|
|
|
@ -354,8 +354,8 @@ typedef struct {
|
||||||
void (*getBindingBuf)( int keynum, char *buf, int buflen );
|
void (*getBindingBuf)( int keynum, char *buf, int buflen );
|
||||||
void (*setBinding)( int keynum, const char *binding );
|
void (*setBinding)( int keynum, const char *binding );
|
||||||
void (*executeText)(int exec_when, const char *text );
|
void (*executeText)(int exec_when, const char *text );
|
||||||
void (*Error)(int level, const char *error, ...);
|
void (*Error)(int level, const char *error, ...) __attribute__ ((format (printf, 2, 3)));
|
||||||
void (*Print)(const char *msg, ...);
|
void (*Print)(const char *msg, ...) __attribute__ ((format (printf, 1, 2)));
|
||||||
void (*Pause)(qboolean b);
|
void (*Pause)(qboolean b);
|
||||||
int (*ownerDrawWidth)(int ownerDraw, float scale);
|
int (*ownerDrawWidth)(int ownerDraw, float scale);
|
||||||
sfxHandle_t (*registerSound)(const char *name, qboolean compressed);
|
sfxHandle_t (*registerSound)(const char *name, qboolean compressed);
|
||||||
|
|
Loading…
Reference in a new issue