[quake3-commits] r2090 - in trunk: . code/botlib code/cgame code/client code/game code/jpeg-8c code/qcommon code/renderer code/server code/sys code/ui

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Mon Jul 18 10:56:58 EDT 2011


Author: thilo
Date: 2011-07-18 10:56:57 -0400 (Mon, 18 Jul 2011)
New Revision: 2090

Modified:
   trunk/Makefile
   trunk/code/botlib/be_aas_main.h
   trunk/code/botlib/be_aas_route.c
   trunk/code/botlib/be_ai_chat.c
   trunk/code/botlib/botlib.h
   trunk/code/botlib/l_log.h
   trunk/code/botlib/l_precomp.h
   trunk/code/botlib/l_script.c
   trunk/code/botlib/l_script.h
   trunk/code/botlib/l_struct.c
   trunk/code/cgame/cg_local.h
   trunk/code/cgame/cg_players.c
   trunk/code/client/cl_main.c
   trunk/code/game/ai_main.h
   trunk/code/game/g_local.h
   trunk/code/game/g_team.c
   trunk/code/jpeg-8c/jerror.c
   trunk/code/qcommon/common.c
   trunk/code/qcommon/q_shared.h
   trunk/code/qcommon/qcommon.h
   trunk/code/qcommon/vm_x86_64.c
   trunk/code/qcommon/vm_x86_64_assembler.c
   trunk/code/renderer/tr_public.h
   trunk/code/server/server.h
   trunk/code/server/sv_bot.c
   trunk/code/server/sv_rankings.c
   trunk/code/sys/sys_local.h
   trunk/code/sys/sys_main.c
   trunk/code/ui/ui_shared.c
   trunk/code/ui/ui_shared.h
Log:
Bug 4812 - GCC __attribute__ annotations for printf, non-returning functions etc., patch by linux at youmustbejoking.demon.co.uk and Zack Middleton


Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/Makefile	2011-07-18 14:56:57 UTC (rev 2090)
@@ -943,6 +943,10 @@
 endif
 
 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)
 echo_cmd=@:

Modified: trunk/code/botlib/be_aas_main.h
===================================================================
--- trunk/code/botlib/be_aas_main.h	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/botlib/be_aas_main.h	2011-07-18 14:56:57 UTC (rev 2090)
@@ -34,7 +34,7 @@
 extern aas_t aasworld;
 
 //AAS error message
-void QDECL AAS_Error(char *fmt, ...);
+void QDECL AAS_Error(char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
 //set AAS initialized
 void AAS_SetInitialized(void);
 //setup AAS with the given number of entities and clients

Modified: trunk/code/botlib/be_aas_route.c
===================================================================
--- trunk/code/botlib/be_aas_route.c	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/botlib/be_aas_route.c	2011-07-18 14:56:57 UTC (rev 2090)
@@ -1065,7 +1065,7 @@
 	botimport.FS_Read(&routecacheheader, sizeof(routecacheheader_t), fp );
 	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;
 	} //end if
 	if (routecacheheader.version != RCVERSION)

Modified: trunk/code/botlib/be_ai_chat.c
===================================================================
--- trunk/code/botlib/be_ai_chat.c	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/botlib/be_ai_chat.c	2011-07-18 14:56:57 UTC (rev 2090)
@@ -698,7 +698,7 @@
 						StripDoubleQuotes(token.string);
 						if (strlen(token.string) <= 0)
 						{
-							SourceError(source, "empty string", token.string);
+							SourceError(source, "empty string");
 							FreeSource(source);
 							return NULL;
 						} //end if

Modified: trunk/code/botlib/botlib.h
===================================================================
--- trunk/code/botlib/botlib.h	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/botlib/botlib.h	2011-07-18 14:56:57 UTC (rev 2090)
@@ -170,7 +170,7 @@
 typedef struct botlib_import_s
 {
 	//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
 	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

Modified: trunk/code/botlib/l_log.h
===================================================================
--- trunk/code/botlib/l_log.h	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/botlib/l_log.h	2011-07-18 14:56:57 UTC (rev 2090)
@@ -36,9 +36,9 @@
 //close log file if present
 void Log_Shutdown(void);
 //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
-void QDECL Log_WriteTimeStamped(char *fmt, ...);
+void QDECL Log_WriteTimeStamped(char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
 //returns a pointer to the log file
 FILE *Log_FilePointer(void);
 //flush log file

Modified: trunk/code/botlib/l_precomp.h
===================================================================
--- trunk/code/botlib/l_precomp.h	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/botlib/l_precomp.h	2011-07-18 14:56:57 UTC (rev 2090)
@@ -152,9 +152,9 @@
 //free the given source
 void FreeSource(source_t *source);
 //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
-void QDECL SourceWarning(source_t *source, char *str, ...);
+void QDECL SourceWarning(source_t *source, char *str, ...)  __attribute__ ((format (printf, 2, 3)));
 
 #ifdef BSPC
 // some of BSPC source does include game/q_shared.h and some does not

Modified: trunk/code/botlib/l_script.c
===================================================================
--- trunk/code/botlib/l_script.c	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/botlib/l_script.c	2011-07-18 14:56:57 UTC (rev 2090)
@@ -990,7 +990,7 @@
 		if (token->subtype != subtype)
 		{
 			ScriptError(script, "expected %s, found %s",
-							script->punctuations[subtype], token->string);
+							script->punctuations[subtype].p, token->string);
 			return 0;
 		} //end if
 	} //end else if
@@ -1158,7 +1158,7 @@
 	{
 		if(!PS_ExpectAnyToken(script, &token))
 		{
-			ScriptError(script, "Missing float value\n", token.string);
+			ScriptError(script, "Missing float value\n");
 			return 0;
 		}
 
@@ -1189,7 +1189,7 @@
 	{
 		if(!PS_ExpectAnyToken(script, &token))
 		{
-			ScriptError(script, "Missing integer value\n", token.string);
+			ScriptError(script, "Missing integer value\n");
 			return 0;
 		}
 

Modified: trunk/code/botlib/l_script.h
===================================================================
--- trunk/code/botlib/l_script.h	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/botlib/l_script.h	2011-07-18 14:56:57 UTC (rev 2090)
@@ -240,8 +240,8 @@
 //set the base folder to load files from
 void PS_SetBaseFolder(char *path);
 //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
-void QDECL ScriptWarning(script_t *script, char *str, ...);
+void QDECL ScriptWarning(script_t *script, char *str, ...) __attribute__ ((format (printf, 2, 3)));
 
 

Modified: trunk/code/botlib/l_struct.c
===================================================================
--- trunk/code/botlib/l_struct.c	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/botlib/l_struct.c	2011-07-18 14:56:57 UTC (rev 2090)
@@ -150,7 +150,7 @@
 		} //end if
 		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;
 		} //end if
 	} //end if
@@ -160,7 +160,7 @@
 		{
 			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;
 			} //end if
 		} //end if

Modified: trunk/code/cgame/cg_local.h
===================================================================
--- trunk/code/cgame/cg_local.h	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/cgame/cg_local.h	2011-07-18 14:56:57 UTC (rev 2090)
@@ -1192,8 +1192,8 @@
 const char *CG_ConfigString( int index );
 const char *CG_Argv( int arg );
 
-void QDECL CG_Printf( const char *msg, ... );
-void QDECL CG_Error( const char *msg, ... );
+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 CG_StartMusic( void );
 

Modified: trunk/code/cgame/cg_players.c
===================================================================
--- trunk/code/cgame/cg_players.c	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/cgame/cg_players.c	2011-07-18 14:56:57 UTC (rev 2090)
@@ -2622,7 +2622,7 @@
 	cent->pe.torso.pitching = qfalse;
 
 	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 );
 	}
 }
 

Modified: trunk/code/client/cl_main.c
===================================================================
--- trunk/code/client/cl_main.c	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/client/cl_main.c	2011-07-18 14:56:57 UTC (rev 2090)
@@ -2487,7 +2487,7 @@
 void CL_ConnectionlessPacket( netadr_t from, msg_t *msg ) {
 	char	*s;
 	char	*c;
-	int challenge;
+	int challenge = 0;
 
 	MSG_BeginReadingOOB( msg );
 	MSG_ReadLong( msg );	// skip the -1
@@ -2968,7 +2968,7 @@
 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;
 	char		msg[MAXPRINTMSG];
 	

Modified: trunk/code/game/ai_main.h
===================================================================
--- trunk/code/game/ai_main.h	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/game/ai_main.h	2011-07-18 14:56:57 UTC (rev 2090)
@@ -290,7 +290,7 @@
 #define FloatTime() floattime
 
 // 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	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 );

Modified: trunk/code/game/g_local.h
===================================================================
--- trunk/code/game/g_local.h	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/game/g_local.h	2011-07-18 14:56:57 UTC (rev 2090)
@@ -624,10 +624,10 @@
 void CheckTeamLeader( int team );
 void G_RunThink (gentity_t *ent);
 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 QDECL G_Printf( const char *fmt, ... );
-void QDECL G_Error( const char *fmt, ... );
+void QDECL G_Printf( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2)));
+void QDECL G_Error( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2)));
 
 //
 // g_client.c

Modified: trunk/code/game/g_team.c
===================================================================
--- trunk/code/game/g_team.c	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/game/g_team.c	2011-07-18 14:56:57 UTC (rev 2090)
@@ -102,7 +102,7 @@
 }
 
 // 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];
 	va_list		argptr;
 	char		*p;

Modified: trunk/code/jpeg-8c/jerror.c
===================================================================
--- trunk/code/jpeg-8c/jerror.c	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/jpeg-8c/jerror.c	2011-07-18 14:56:57 UTC (rev 2090)
@@ -68,7 +68,7 @@
  * or jpeg_destroy) at some point.
  */
 
-METHODDEF(void)
+__attribute__ ((noreturn)) METHODDEF(void)
 error_exit (j_common_ptr cinfo)
 {
   /* Always display the message */

Modified: trunk/code/qcommon/common.c
===================================================================
--- trunk/code/qcommon/common.c	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/qcommon/common.c	2011-07-18 14:56:57 UTC (rev 2090)
@@ -260,19 +260,10 @@
 	va_list		argptr;
 	static int	lastErrorTime;
 	static int	errorCount;
-	static qboolean	calledSysError = qfalse;
 	int			currentTime;
 
 	if(com_errorEntered)
-	{
-		if(!calledSysError)
-		{
-			calledSysError = qtrue;
-			Sys_Error("recursive error after: %s", com_errorMessage);
-		}
-		
-		return;
-	}
+		Sys_Error("recursive error after: %s", com_errorMessage);
 
 	com_errorEntered = qtrue;
 
@@ -348,7 +339,6 @@
 
 	Com_Shutdown ();
 
-	calledSysError = qtrue;
 	Sys_Error ("%s", com_errorMessage);
 }
 

Modified: trunk/code/qcommon/q_shared.h
===================================================================
--- trunk/code/qcommon/q_shared.h	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/qcommon/q_shared.h	2011-07-18 14:56:57 UTC (rev 2090)
@@ -849,7 +849,7 @@
 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)));
 
 

Modified: trunk/code/qcommon/qcommon.h
===================================================================
--- trunk/code/qcommon/qcommon.h	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/qcommon/qcommon.h	2011-07-18 14:56:57 UTC (rev 2090)
@@ -821,8 +821,8 @@
 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 		Com_Quit_f( void );
+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);
 
 int			Com_Milliseconds( void );	// will be journaled properly
@@ -1087,8 +1087,8 @@
 
 char	*Sys_GetCurrentUser( void );
 
-void	QDECL Sys_Error( const char *error, ...) __attribute__ ((format (printf, 1, 2)));
-void	Sys_Quit (void);
+void	QDECL Sys_Error( const char *error, ...) __attribute__ ((noreturn)) __attribute__ ((format (printf, 1, 2)));
+void	Sys_Quit (void) __attribute__ ((noreturn));
 char	*Sys_GetClipboardData( void );	// note that this isn't journaled...
 
 void	Sys_Print( const char *msg );

Modified: trunk/code/qcommon/vm_x86_64.c
===================================================================
--- trunk/code/qcommon/vm_x86_64.c	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/qcommon/vm_x86_64.c	2011-07-18 14:56:57 UTC (rev 2090)
@@ -229,7 +229,7 @@
 	[OP_BLOCK_COPY] = 4,
 };
 
-void emit(const char* fmt, ...)
+static __attribute__ ((format (printf, 1, 2))) void emit(const char* fmt, ...)
 {
 	va_list ap;
 	char line[4096];
@@ -381,26 +381,26 @@
        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!");
 	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");
 	exit(1);
 }
 
 #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");
 	exit(1);
 }
 
-static void CROSSCALL opstackviolation(void)
+static __attribute__ ((noreturn)) void CROSSCALL opstackviolation(void)
 {
 	Com_Error(ERR_DROP, "Program corrupted the VM opStack");
 	exit(1);

Modified: trunk/code/qcommon/vm_x86_64_assembler.c
===================================================================
--- trunk/code/qcommon/vm_x86_64_assembler.c	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/qcommon/vm_x86_64_assembler.c	2011-07-18 14:56:57 UTC (rev 2090)
@@ -30,6 +30,13 @@
 
 #include <inttypes.h>
 
+// Ignore __attribute__ on non-gcc platforms
+#ifndef __GNUC__
+#ifndef __attribute__
+#define __attribute__(x)
+#endif
+#endif
+
 typedef uint8_t u8;
 typedef uint16_t u16;
 typedef uint32_t u32;
@@ -55,7 +62,7 @@
 #define debug(fmt, args...)
 #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;
 	fprintf(stderr, "%s() - ", func);

Modified: trunk/code/renderer/tr_public.h
===================================================================
--- trunk/code/renderer/tr_public.h	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/renderer/tr_public.h	2011-07-18 14:56:57 UTC (rev 2090)
@@ -106,10 +106,10 @@
 //
 typedef struct {
 	// 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
-	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
 	// for anything game related.  Get time from the refdef

Modified: trunk/code/server/server.h
===================================================================
--- trunk/code/server/server.h	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/server/server.h	2011-07-18 14:56:57 UTC (rev 2090)
@@ -310,7 +310,7 @@
 // sv_main.c
 //
 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);

Modified: trunk/code/server/sv_bot.c
===================================================================
--- trunk/code/server/sv_bot.c	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/server/sv_bot.c	2011-07-18 14:56:57 UTC (rev 2090)
@@ -133,7 +133,7 @@
 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];
 	va_list ap;

Modified: trunk/code/server/sv_rankings.c
===================================================================
--- trunk/code/server/sv_rankings.c	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/server/sv_rankings.c	2011-07-18 14:56:57 UTC (rev 2090)
@@ -68,7 +68,7 @@
 static uint64_t	SV_RankDecodePlayerID( const char* string );
 static void		SV_RankDecodePlayerKey( const char* string, GR_PLAYER_TOKEN key );
 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];
 
 /*

Modified: trunk/code/sys/sys_local.h
===================================================================
--- trunk/code/sys/sys_local.h	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/sys/sys_local.h	2011-07-18 14:56:57 UTC (rev 2090)
@@ -52,7 +52,7 @@
 void Sys_GLimpInit( void );
 void Sys_PlatformInit( 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_AnsiColorPrint( const char *msg );
 

Modified: trunk/code/sys/sys_main.c
===================================================================
--- trunk/code/sys/sys_main.c	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/sys/sys_main.c	2011-07-18 14:56:57 UTC (rev 2090)
@@ -193,7 +193,7 @@
 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( );
 
@@ -351,18 +351,18 @@
 	Q_vsnprintf (string, sizeof(string), error, argptr);
 	va_end (argptr);
 
-	CL_Shutdown(string, qtrue);
 	Sys_ErrorDialog( string );
 
 	Sys_Exit( 3 );
 }
 
+#if 0
 /*
 =================
 Sys_Warn
 =================
 */
-void Sys_Warn( char *warning, ... )
+static __attribute__ ((format (printf, 1, 2))) void Sys_Warn( char *warning, ... )
 {
 	va_list argptr;
 	char    string[1024];
@@ -373,6 +373,7 @@
 
 	CON_Print( va( "Warning: %s", string ) );
 }
+#endif
 
 /*
 ============

Modified: trunk/code/ui/ui_shared.c
===================================================================
--- trunk/code/ui/ui_shared.c	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/ui/ui_shared.c	2011-07-18 14:56:57 UTC (rev 2090)
@@ -251,7 +251,7 @@
 PC_SourceWarning
 =================
 */
-void PC_SourceWarning(int handle, char *format, ...) {
+static __attribute__ ((format (printf, 2, 3))) void PC_SourceWarning(int handle, char *format, ...) {
 	int line;
 	char filename[128];
 	va_list argptr;
@@ -273,7 +273,7 @@
 PC_SourceError
 =================
 */
-void PC_SourceError(int handle, char *format, ...) {
+static __attribute__ ((format (printf, 2, 3))) void PC_SourceError(int handle, char *format, ...) {
 	int line;
 	char filename[128];
 	va_list argptr;

Modified: trunk/code/ui/ui_shared.h
===================================================================
--- trunk/code/ui/ui_shared.h	2011-07-18 14:23:54 UTC (rev 2089)
+++ trunk/code/ui/ui_shared.h	2011-07-18 14:56:57 UTC (rev 2090)
@@ -354,8 +354,8 @@
 	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, ...);
-	void (*Print)(const char *msg, ...);
+	void (*Error)(int level, const char *error, ...) __attribute__ ((format (printf, 2, 3)));
+	void (*Print)(const char *msg, ...) __attribute__ ((format (printf, 1, 2)));
 	void (*Pause)(qboolean b);
 	int (*ownerDrawWidth)(int ownerDraw, float scale);
 	sfxHandle_t (*registerSound)(const char *name, qboolean compressed);



More information about the quake3-commits mailing list