mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
maybe_unused with older compilers
This commit is contained in:
parent
5b5afe2b4a
commit
c96f67ce72
|
@ -18,6 +18,14 @@
|
|||
((void)(addr), (void)(size))
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
#define MAYBE_UNUSED [[maybe_unused]]
|
||||
#elif defined(__GNUC__)
|
||||
#define MAYBE_UNUSED __attribute__((unused))
|
||||
#else
|
||||
#define MAYBE_UNUSED
|
||||
#endif
|
||||
|
||||
#define MACRO_ALLOC_HEAP() \
|
||||
public: \
|
||||
void *operator new(size_t Size) \
|
||||
|
@ -50,7 +58,7 @@ private:
|
|||
#define MACRO_ALLOC_POOL_ID_IMPL(POOLTYPE, PoolSize) \
|
||||
static char ms_PoolData##POOLTYPE[PoolSize][MACRO_ALLOC_GET_SIZE(POOLTYPE)] = {{0}}; \
|
||||
static int ms_PoolUsed##POOLTYPE[PoolSize] = {0}; \
|
||||
[[maybe_unused]] static int ms_PoolDummy##POOLTYPE = (ASAN_POISON_MEMORY_REGION(ms_PoolData##POOLTYPE, sizeof(ms_PoolData##POOLTYPE)), 0); \
|
||||
MAYBE_UNUSED static int ms_PoolDummy##POOLTYPE = (ASAN_POISON_MEMORY_REGION(ms_PoolData##POOLTYPE, sizeof(ms_PoolData##POOLTYPE)), 0); \
|
||||
void *POOLTYPE::operator new(size_t Size, int id) \
|
||||
{ \
|
||||
dbg_assert(sizeof(POOLTYPE) >= Size, "size error"); \
|
||||
|
|
Loading…
Reference in a new issue