diff --git a/inc/common/common.h b/inc/common/common.h index 470d3ddf0..93740cb95 100644 --- a/inc/common/common.h +++ b/inc/common/common.h @@ -86,7 +86,8 @@ void Com_AbortFunc(void (*func)(void *), void *arg); void Com_SetLastError(const char *msg); const char *Com_GetLastError(void); -void Com_Quit(const char *reason, error_type_t type) q_noreturn; +q_noreturn +void Com_Quit(const char *reason, error_type_t type); void Com_SetColor(color_index_t color); diff --git a/inc/common/zone.h b/inc/common/zone.h index 443a5efc2..0cada9337 100644 --- a/inc/common/zone.h +++ b/inc/common/zone.h @@ -46,11 +46,16 @@ void Z_Free(void *ptr); void Z_Freep(void *ptr); void *Z_Realloc(void *ptr, size_t size); void *Z_ReallocArray(void *ptr, size_t nmemb, size_t size); -void *Z_Malloc(size_t size) q_malloc; -void *Z_Mallocz(size_t size) q_malloc; -void *Z_TagMalloc(size_t size, memtag_t tag) q_malloc; -void *Z_TagMallocz(size_t size, memtag_t tag) q_malloc; -char *Z_TagCopyString(const char *in, memtag_t tag) q_malloc; +q_malloc +void *Z_Malloc(size_t size); +q_malloc +void *Z_Mallocz(size_t size); +q_malloc +void *Z_TagMalloc(size_t size, memtag_t tag); +q_malloc +void *Z_TagMallocz(size_t size, memtag_t tag); +q_malloc +char *Z_TagCopyString(const char *in, memtag_t tag); void Z_FreeTags(memtag_t tag); void Z_LeakTest(memtag_t tag); void Z_Stats_f(void); diff --git a/inc/shared/game.h b/inc/shared/game.h index f17c65cbe..df89239d7 100644 --- a/inc/shared/game.h +++ b/inc/shared/game.h @@ -145,7 +145,7 @@ typedef struct { // they connect, and changes are sent to all connected clients. void (*configstring)(int num, const char *string); - void (* q_noreturn q_printf(1, 2) error)(const char *fmt, ...); + void (* q_noreturn_ptr q_printf(1, 2) error)(const char *fmt, ...); // the *index functions create configstrings and some internal server state int (*modelindex)(const char *name); diff --git a/inc/shared/platform.h b/inc/shared/platform.h index 9eed15eac..2b3b7fe8e 100644 --- a/inc/shared/platform.h +++ b/inc/shared/platform.h @@ -92,6 +92,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #define q_printf(f, a) __attribute__((format(printf, f, a))) #endif #define q_noreturn __attribute__((noreturn)) +#define q_noreturn_ptr q_noreturn #define q_noinline __attribute__((noinline)) #define q_malloc __attribute__((malloc)) #if __GNUC__ >= 4 @@ -126,21 +127,26 @@ with this program; if not, write to the Free Software Foundation, Inc., #else /* __GNUC__ */ -#define q_printf(f, a) +#ifdef _MSC_VER +#define q_noreturn __declspec(noreturn) +#define q_noinline __declspec(noinline) +#define q_malloc __declspec(restrict) +#define q_alignof(t) __alignof(t) +#else #define q_noreturn #define q_noinline #define q_malloc +#define q_alignof(t) 1 +#endif + +#define q_printf(f, a) +#define q_noreturn_ptr #define q_sentinel #define q_cold #define q_likely(x) (x) #define q_unlikely(x) (x) #define q_offsetof(t, m) ((size_t)&((t *)0)->m) -#ifdef _MSC_VER -#define q_alignof(t) __alignof(t) -#else -#define q_alignof(t) 1 -#endif #define q_gameabi diff --git a/inc/shared/shared.h b/inc/shared/shared.h index d453a3428..251c2948d 100644 --- a/inc/shared/shared.h +++ b/inc/shared/shared.h @@ -103,10 +103,11 @@ typedef enum { PRINT_NOTICE // print in cyan color } print_type_t; -void Com_LPrintf(print_type_t type, const char *fmt, ...) -q_printf(2, 3); -void Com_Error(error_type_t code, const char *fmt, ...) -q_cold q_noreturn q_printf(2, 3); +q_printf(2, 3) +void Com_LPrintf(print_type_t type, const char *fmt, ...); + +q_cold q_noreturn q_printf(2, 3) +void Com_Error(error_type_t code, const char *fmt, ...); #define Com_Printf(...) Com_LPrintf(PRINT_ALL, __VA_ARGS__) #define Com_WPrintf(...) Com_LPrintf(PRINT_WARNING, __VA_ARGS__) diff --git a/inc/system/system.h b/inc/system/system.h index 3199c1d82..6d021d721 100644 --- a/inc/system/system.h +++ b/inc/system/system.h @@ -55,8 +55,11 @@ void Sys_Printf(const char *fmt, ...) q_printf(1, 2); #define Sys_Printf(...) (void)0 #endif -void Sys_Error(const char *error, ...) q_noreturn q_printf(1, 2); -void Sys_Quit(void) q_noreturn; +q_noreturn q_printf(1, 2) +void Sys_Error(const char *error, ...); + +q_noreturn +void Sys_Quit(void); void Sys_ListFiles_r(listfiles_t *list, const char *path, int depth); diff --git a/src/server/mvd/client.h b/src/server/mvd/client.h index 27dc782a9..1ce9d7e3f 100644 --- a/src/server/mvd/client.h +++ b/src/server/mvd/client.h @@ -199,7 +199,8 @@ extern jmp_buf mvd_jmpbuf; extern cvar_t *mvd_shownet; #endif -void MVD_Destroyf(mvd_t *mvd, const char *fmt, ...) q_noreturn q_printf(2, 3); +q_noreturn q_printf(2, 3) +void MVD_Destroyf(mvd_t *mvd, const char *fmt, ...); void MVD_Shutdown(void); mvd_t *MVD_SetChannel(int arg);