C++20 Support (#31)

This commit is contained in:
Nic Barker 2024-09-29 12:53:46 +13:00 committed by GitHub
parent 21d9f06a47
commit 948b7ce70b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 371 additions and 246 deletions

View file

@ -6,5 +6,5 @@ typedef struct
} $NAME$;
$NAME$ $NAME$_Allocate_Arena(uint32_t capacity, Clay_Arena *arena) {
return ($NAME$){.capacity = capacity, .length = 0, .internalArray = ($TYPE$ *)Clay__Array_Allocate_Arena(capacity, sizeof($TYPE$), CLAY__ALIGNMENT($TYPE$), arena)};
return CLAY__INIT($NAME$){.capacity = capacity, .length = 0, .internalArray = ($TYPE$ *)Clay__Array_Allocate_Arena(capacity, sizeof($TYPE$), CLAY__ALIGNMENT($TYPE$), arena)};
}

View file

@ -4,7 +4,7 @@ void $NAME$_Set($NAME$ *array, int index, $TYPE$ value) {
array->length = index < array->length ? array->length : index + 1;
} else {
if (Clay__warningsEnabled) {
Clay__WarningArray_Add(&Clay_warnings, (Clay__Warning) { CLAY_STRING("Attempting to allocate array in arena, but arena is already at capacity and would overflow.") });
Clay__WarningArray_Add(&Clay_warnings, CLAY__INIT(Clay__Warning) { CLAY_STRING("Attempting to allocate array in arena, but arena is already at capacity and would overflow.") });
}
#ifdef CLAY_OVERFLOW_TRAP
raise(SIGTRAP);