Wrap __attribute__s in macros

This commit is contained in:
Tim Angus committed 2025-09-07 17:16:31 +01:00
1 parent f976711fb4
commit 07b9c1bd83
33 files changed
+88 -114

No files matched your search

+1 -1
View File
@@ -2280,7 +2280,7 @@ Just throw a fatal error to
test error shutdown procedures
=============
*/
static void __attribute__((__noreturn__)) Com_Error_f (void) {
static void Q_NO_RETURN Com_Error_f (void) {
if ( Cmd_Argc() > 1 ) {
Com_Error( ERR_DROP, "Testing drop error" );
} else {
+1 -1
View File
@@ -753,7 +753,7 @@ int Q_isalpha( int c )
qboolean Q_isanumber( const char *s )
{
char *p;
double UNUSED_VAR d;
double Q_UNUSED_VAR d;
if( *s == '\0' )
return qfalse;
+16 -21
View File
@@ -105,17 +105,18 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//#pragma intrinsic( memset, memcpy )
#endif
//Ignore __attribute__ on non-gcc platforms
#ifndef __GNUC__
#ifndef __attribute__
#define __attribute__(x)
#endif
#endif
#ifdef __GNUC__
#define UNUSED_VAR __attribute__((unused))
#define Q_UNUSED_VAR __attribute__((unused))
#define Q_NO_RETURN __attribute__((noreturn))
#define Q_PRINTF_FUNC(fmt, va) __attribute__((format(printf, fmt, va)))
#define Q_SCANF_FUNC(fmt, va) __attribute__((format(scanf, fmt, va)))
#define Q_ALIGN(x) __attribute__((aligned(x)))
#else
#define UNUSED_VAR
#define Q_UNUSED_VAR
#define Q_NO_RETURN
#define Q_PRINTF_FUNC(fmt, va)
#define Q_SCANF_FUNC(fmt, va)
#define Q_ALIGN(x)
#endif
#if (defined _MSC_VER)
@@ -199,12 +200,6 @@ typedef int clipHandle_t;
#define PADP(base, alignment) ((void *) PAD((intptr_t) (base), (alignment)))
#ifdef __GNUC__
#define QALIGN(x) __attribute__((aligned(x)))
#else
#define QALIGN(x)
#endif
#ifndef NULL
#define NULL ((void *)0)
#endif
@@ -733,8 +728,8 @@ int COM_GetCurrentParseLine( void );
char *COM_Parse( char **data_p );
char *COM_ParseExt( char **data_p, qboolean allowLineBreak );
int COM_Compress( char *data_p );
void COM_ParseError( char *format, ... ) __attribute__ ((format (printf, 1, 2)));
void COM_ParseWarning( char *format, ... ) __attribute__ ((format (printf, 1, 2)));
void COM_ParseError( char *format, ... ) Q_PRINTF_FUNC(1, 2);
void COM_ParseWarning( char *format, ... ) Q_PRINTF_FUNC(1, 2);
//int COM_ParseInfos( char *buf, int max, char infos[][MAX_INFO_STRING] );
#define MAX_TOKENLENGTH 1024
@@ -769,7 +764,7 @@ void Parse2DMatrix (char **buf_p, int y, int x, float *m);
void Parse3DMatrix (char **buf_p, int z, int y, int x, float *m);
int Com_HexStrToInt( const char *str );
int QDECL Com_sprintf (char *dest, int size, const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
int QDECL Com_sprintf (char *dest, int size, const char *fmt, ...) Q_PRINTF_FUNC(3, 4);
char *Com_SkipTokens( char *s, int numTokens, char *sep );
char *Com_SkipCharset( char *s, char *sep );
@@ -847,7 +842,7 @@ float LittleFloat (const float *l);
void Swap_Init (void);
*/
char * QDECL va(char *format, ...) __attribute__ ((format (printf, 1, 2)));
char * QDECL va(char *format, ...) Q_PRINTF_FUNC(1, 2);
#define TRUNCATE_LENGTH 64
void Com_TruncateLongString( char *buffer, const char *s );
@@ -866,8 +861,8 @@ 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__ ((noreturn, format(printf, 2, 3)));
void QDECL Com_Printf( const char *msg, ... ) __attribute__ ((format (printf, 1, 2)));
void QDECL Com_Error( int level, const char *error, ... ) Q_NO_RETURN Q_PRINTF_FUNC(2, 3);
void QDECL Com_Printf( const char *msg, ... ) Q_PRINTF_FUNC(1, 2);
/*
+8 -15
View File
@@ -25,13 +25,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../qcommon/cm_public.h"
//Ignore __attribute__ on non-gcc platforms
#ifndef __GNUC__
#ifndef __attribute__
#define __attribute__(x)
#endif
#endif
//#define PRE_RELEASE_DEMO
//============================================================================
@@ -172,7 +165,7 @@ void NET_Restart_f( void );
void NET_Config( qboolean enableNetworking );
void NET_FlushPacketQueue(void);
void NET_SendPacket (netsrc_t sock, int length, const void *data, netadr_t to);
void QDECL NET_OutOfBandPrint( netsrc_t net_socket, netadr_t adr, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
void QDECL NET_OutOfBandPrint( netsrc_t net_socket, netadr_t adr, const char *format, ...) Q_PRINTF_FUNC(3, 4);
void QDECL NET_OutOfBandData( netsrc_t sock, netadr_t adr, byte *format, int len );
qboolean NET_CompareAdr (netadr_t a, netadr_t b);
@@ -692,7 +685,7 @@ int FS_FTell( fileHandle_t f );
void FS_Flush( fileHandle_t f );
void QDECL FS_Printf( fileHandle_t f, const char *fmt, ... ) __attribute__ ((format (printf, 2, 3)));
void QDECL FS_Printf( fileHandle_t f, const char *fmt, ... ) Q_PRINTF_FUNC(2, 3);
// like fprintf
int FS_FOpenFileByMode( const char *qpath, fileHandle_t *f, fsMode_t mode );
@@ -821,10 +814,10 @@ void Info_Print( const char *s );
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__ ((noreturn, format(printf, 2, 3)));
void Com_Quit_f( void ) __attribute__ ((noreturn));
void QDECL Com_Printf( const char *fmt, ... ) Q_PRINTF_FUNC(1, 2);
void QDECL Com_DPrintf( const char *fmt, ... ) Q_PRINTF_FUNC(1, 2);
void QDECL Com_Error( int code, const char *fmt, ... ) Q_NO_RETURN Q_PRINTF_FUNC(2, 3);
void Com_Quit_f( void ) Q_NO_RETURN;
void Com_GameRestart(int checksumFeed, qboolean disconnect);
int Com_Milliseconds( void ); // will be journaled properly
@@ -1087,8 +1080,8 @@ qboolean Sys_DllExtension( const char *name );
char *Sys_GetCurrentUser( void );
void QDECL Sys_Error( const char *error, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
void Sys_Quit (void) __attribute__ ((noreturn));
void QDECL Sys_Error( const char *error, ...) Q_NO_RETURN Q_PRINTF_FUNC(1, 2);
void Sys_Quit (void) Q_NO_RETURN;
char *Sys_GetClipboardData( void ); // note that this isn't journaled...
void Sys_Print( const char *msg );
-7
View File
@@ -27,13 +27,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// This file must be identical in the quake and utils directories
//
//Ignore __attribute__ on non-gcc platforms
#ifndef __GNUC__
#ifndef __attribute__
#define __attribute__(x)
#endif
#endif
// surface geometry should not exceed these limits
#define SHADER_MAX_VERTEXES 1000
#define SHADER_MAX_INDEXES (6*SHADER_MAX_VERTEXES)
+1 -1
View File
@@ -217,7 +217,7 @@ Error handler for jump/call to invalid instruction number
=================
*/
static void __attribute__((__noreturn__)) ErrJump(unsigned num)
static void NO_RETURN ErrJump(unsigned num)
{
Com_Error(ERR_DROP, "program tried to execute code outside VM (%x)", num);
}
+1 -1
View File
@@ -389,7 +389,7 @@ Error handler for jump/call to invalid instruction number
=================
*/
static void __attribute__((__noreturn__)) ErrJump(void)
static void Q_NO_RETURN ErrJump(void)
{
Com_Error(ERR_DROP, "program tried to execute code outside VM");
}