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

+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);
/*