common: xash3d_types: add Quake's link_t definition and offsetof macro

This commit is contained in:
Alibek Omarov
2026-02-26 05:59:42 +05:00
parent 2c004e6cb7
commit d8e1597726
2 changed files with 15 additions and 5 deletions

View File

@@ -735,11 +735,6 @@ typedef struct
unsigned r, g, b, a; unsigned r, g, b, a;
} colorVec; } colorVec;
typedef struct link_s
{
struct link_s *prev, *next;
} link_t;
typedef struct edict_s edict_t; typedef struct edict_s edict_t;
typedef struct typedef struct

View File

@@ -50,6 +50,12 @@ typedef ssize_t fs_size_t;
typedef unsigned int uint; typedef unsigned int uint;
typedef void *(*pfnCreateInterface_t)( const char *, int * ); typedef void *(*pfnCreateInterface_t)( const char *, int * );
// Quake definition
typedef struct link_s
{
struct link_s *prev, *next;
} link_t;
#undef true #undef true
#undef false #undef false
@@ -109,10 +115,15 @@ typedef int qboolean;
#define ALLOC_CHECK( x ) __attribute__(( alloc_size( x ))) #define ALLOC_CHECK( x ) __attribute__(( alloc_size( x )))
#define WARN_UNUSED_RESULT __attribute__(( warn_unused_result )) #define WARN_UNUSED_RESULT __attribute__(( warn_unused_result ))
#define RENAME_SYMBOL( x ) asm( x ) #define RENAME_SYMBOL( x ) asm( x )
#if !defined( offsetof )
#define offsetof( s, m ) __builtin_offsetof( s, m )
#endif // !defined( offsetof )
#elif defined( _MSC_VER ) #elif defined( _MSC_VER )
#define EXPORT __declspec( dllexport ) #define EXPORT __declspec( dllexport )
#endif #endif
#define ARRAYSIZE( p ) ( sizeof(( p ))/ sizeof(( p )[0] ))
#if defined( __SANITIZE_ADDRESS__ ) #if defined( __SANITIZE_ADDRESS__ )
#define USE_ASAN 1 #define USE_ASAN 1
@@ -196,6 +207,10 @@ typedef int qboolean;
#define XASH_RESTRICT #define XASH_RESTRICT
#endif #endif
#if !defined( offsetof )
#define offsetof( s, m ) (size_t)&(((s *)0)->m )
#endif // !defined( offsetof )
#if __STDC_VERSION__ >= 202311L || __cplusplus >= 201103L // C23 or C++ static_assert is a keyword #if __STDC_VERSION__ >= 202311L || __cplusplus >= 201103L // C23 or C++ static_assert is a keyword
#define STATIC_ASSERT_( ignore, x, y ) static_assert( x, y ) #define STATIC_ASSERT_( ignore, x, y ) static_assert( x, y )
#define STATIC_ASSERT static_assert #define STATIC_ASSERT static_assert