summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/cl_main.c4
-rw-r--r--src/jpeg-8c/jerror.c2
-rw-r--r--src/qcommon/common.c12
-rw-r--r--src/qcommon/q_shared.h2
-rw-r--r--src/qcommon/qcommon.h8
-rw-r--r--src/qcommon/vm_x86_64.c10
-rw-r--r--src/qcommon/vm_x86_64_assembler.c9
-rw-r--r--src/renderer/tr_public.h4
-rw-r--r--src/server/server.h2
-rw-r--r--src/sys/sys_local.h2
-rw-r--r--src/sys/sys_main.c7
11 files changed, 30 insertions, 32 deletions
diff --git a/src/client/cl_main.c b/src/client/cl_main.c
index 1f95b7e0..ad1acc83 100644
--- a/src/client/cl_main.c
+++ b/src/client/cl_main.c
@@ -2646,7 +2646,7 @@ Responses to broadcasts, etc
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
@@ -3096,7 +3096,7 @@ CL_RefPrintf
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];
diff --git a/src/jpeg-8c/jerror.c b/src/jpeg-8c/jerror.c
index 2860d3fa..425bef1c 100644
--- a/src/jpeg-8c/jerror.c
+++ b/src/jpeg-8c/jerror.c
@@ -68,7 +68,7 @@ const char * const jpeg_std_message_table[] = {
* or jpeg_destroy) at some point.
*/
-METHODDEF(void)
+__attribute__ ((noreturn)) METHODDEF(void)
error_exit (j_common_ptr cinfo)
{
/* Always display the message */
diff --git a/src/qcommon/common.c b/src/qcommon/common.c
index 6b61e98a..0a4e7eba 100644
--- a/src/qcommon/common.c
+++ b/src/qcommon/common.c
@@ -256,19 +256,10 @@ void QDECL Com_Error( int code, const char *fmt, ... ) {
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;
@@ -344,7 +335,6 @@ void QDECL Com_Error( int code, const char *fmt, ... ) {
Com_Shutdown ();
- calledSysError = qtrue;
Sys_Error ("%s", com_errorMessage);
}
diff --git a/src/qcommon/q_shared.h b/src/qcommon/q_shared.h
index cb05a61e..5e701cc6 100644
--- a/src/qcommon/q_shared.h
+++ b/src/qcommon/q_shared.h
@@ -910,7 +910,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 a436641e..035d98b1 100644
--- a/src/qcommon/qcommon.h
+++ b/src/qcommon/qcommon.h
@@ -799,8 +799,8 @@ 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 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
@@ -1057,8 +1057,8 @@ void *Sys_GetBotLibAPI( void *parms );
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 );
diff --git a/src/qcommon/vm_x86_64.c b/src/qcommon/vm_x86_64.c
index 1071e79f..36dd95b5 100644
--- a/src/qcommon/vm_x86_64.c
+++ b/src/qcommon/vm_x86_64.c
@@ -230,7 +230,7 @@ static unsigned char op_argsize[256] =
[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];
@@ -382,26 +382,26 @@ static void* getentrypoint(vm_t* vm)
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);
diff --git a/src/qcommon/vm_x86_64_assembler.c b/src/qcommon/vm_x86_64_assembler.c
index ad2aeea5..2fb67cf1 100644
--- a/src/qcommon/vm_x86_64_assembler.c
+++ b/src/qcommon/vm_x86_64_assembler.c
@@ -32,6 +32,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#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;
@@ -57,7 +64,7 @@ static FILE* fout;
#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);
diff --git a/src/renderer/tr_public.h b/src/renderer/tr_public.h
index 1a7d93c2..b1ccfbc1 100644
--- a/src/renderer/tr_public.h
+++ b/src/renderer/tr_public.h
@@ -108,10 +108,10 @@ typedef struct {
//
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
diff --git a/src/server/server.h b/src/server/server.h
index 56f9b1cb..daa0dee7 100644
--- a/src/server/server.h
+++ b/src/server/server.h
@@ -295,7 +295,7 @@ extern cvar_t *sv_voip;
// 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);
diff --git a/src/sys/sys_local.h b/src/sys/sys_local.h
index 8f99e7c5..2c12a464 100644
--- a/src/sys/sys_local.h
+++ b/src/sys/sys_local.h
@@ -53,7 +53,7 @@ void Sys_GLimpSafeInit( void );
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 );
diff --git a/src/sys/sys_main.c b/src/sys/sys_main.c
index 8bc5f80f..9e4d6863 100644
--- a/src/sys/sys_main.c
+++ b/src/sys/sys_main.c
@@ -194,7 +194,7 @@ Sys_Exit
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( );
@@ -352,18 +352,18 @@ void Sys_Error( const char *error, ... )
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];
@@ -374,6 +374,7 @@ void Sys_Warn( char *warning, ... )
CON_Print( va( "Warning: %s", string ) );
}
+#endif
/*
============