diff --git a/common/xash3d_types.h b/common/xash3d_types.h index 7ee87db8..6b375a33 100644 --- a/common/xash3d_types.h +++ b/common/xash3d_types.h @@ -79,11 +79,22 @@ typedef uint64_t longtime_t; #define GAME_EXPORT #endif + #define MALLOC __attribute__(( malloc )) + + // added in GCC 11 + #if __GNUC__ >= 11 + // might want to set noclone due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116893 + // but it's easier to not force mismatched-dealloc to error yet + #define MALLOC_LIKE( x, y ) __attribute__(( malloc( x, y ))) + #else + #define MALLOC_LIKE( x, y ) MALLOC + #endif #define NORETURN __attribute__(( noreturn )) #define NONNULL __attribute__(( nonnull )) #define _format( x ) __attribute__(( format( printf, x, x + 1 ))) #define ALLOC_CHECK( x ) __attribute__(( alloc_size( x ))) #define NO_ASAN __attribute__(( no_sanitize( "address" ))) + #define WARN_UNUSED_RESULT __attribute__(( warn_unused_result )) #define RENAME_SYMBOL( x ) asm( x ) #else #if defined( _MSC_VER ) @@ -99,6 +110,9 @@ typedef uint64_t longtime_t; #define _format( x ) #define ALLOC_CHECK( x ) #define RENAME_SYMBOL( x ) + #define MALLOC + #define MALLOC_LIKE( x, y ) + #define WARN_UNUSED_RESULT #endif #if __GNUC__ >= 3