Skip to content

Commit 025ca71

Browse files
authored
Merge pull request #564 from pusewicz/use-cf-static-assert
Use CF_STATIC_ASSERT instead of bare static_assert
2 parents eb2927e + 2ba3374 commit 025ca71

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

src/cute_graphics_sdlgpu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ using namespace Cute;
2323
// SDL_GPUSampleCount -- that's only correct because both enums index 1x/2x/4x/8x as 0/1/2/3
2424
// in the same order. Catch it at compile time if SDL ever renumbers its enum, rather than
2525
// silently mis-sampling MSAA targets again.
26-
static_assert(
26+
CF_STATIC_ASSERT(
2727
(int)CF_SAMPLE_COUNT_1 == (int)SDL_GPU_SAMPLECOUNT_1 &&
2828
(int)CF_SAMPLE_COUNT_2 == (int)SDL_GPU_SAMPLECOUNT_2 &&
2929
(int)CF_SAMPLE_COUNT_4 == (int)SDL_GPU_SAMPLECOUNT_4 &&

src/cute_json.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -230,18 +230,18 @@ CF_JVal cf_json_array_get(CF_JVal val_handle, int index)
230230
}
231231

232232
// Make sure memory layout is identical.
233-
static_assert(sizeof(CF_JIter) == sizeof(yyjson_mut_arr_iter));
234-
static_assert(offsetof(CF_JIter, index) == offsetof(yyjson_mut_arr_iter, idx));
235-
static_assert(offsetof(CF_JIter, count) == offsetof(yyjson_mut_arr_iter, max));
236-
static_assert(offsetof(CF_JIter, val) == offsetof(yyjson_mut_arr_iter, cur));
237-
static_assert(offsetof(CF_JIter, prev) == offsetof(yyjson_mut_arr_iter, pre));
238-
static_assert(offsetof(CF_JIter, parent) == offsetof(yyjson_mut_arr_iter, arr));
239-
static_assert(sizeof(CF_JIter) == sizeof(yyjson_mut_obj_iter));
240-
static_assert(offsetof(CF_JIter, index) == offsetof(yyjson_mut_obj_iter, idx));
241-
static_assert(offsetof(CF_JIter, count) == offsetof(yyjson_mut_obj_iter, max));
242-
static_assert(offsetof(CF_JIter, val) == offsetof(yyjson_mut_obj_iter, cur));
243-
static_assert(offsetof(CF_JIter, prev) == offsetof(yyjson_mut_obj_iter, pre));
244-
static_assert(offsetof(CF_JIter, parent) == offsetof(yyjson_mut_obj_iter, obj));
233+
CF_STATIC_ASSERT(sizeof(CF_JIter) == sizeof(yyjson_mut_arr_iter), "CF_JIter must match yyjson_mut_arr_iter's layout");
234+
CF_STATIC_ASSERT(offsetof(CF_JIter, index) == offsetof(yyjson_mut_arr_iter, idx), "CF_JIter must match yyjson_mut_arr_iter's layout");
235+
CF_STATIC_ASSERT(offsetof(CF_JIter, count) == offsetof(yyjson_mut_arr_iter, max), "CF_JIter must match yyjson_mut_arr_iter's layout");
236+
CF_STATIC_ASSERT(offsetof(CF_JIter, val) == offsetof(yyjson_mut_arr_iter, cur), "CF_JIter must match yyjson_mut_arr_iter's layout");
237+
CF_STATIC_ASSERT(offsetof(CF_JIter, prev) == offsetof(yyjson_mut_arr_iter, pre), "CF_JIter must match yyjson_mut_arr_iter's layout");
238+
CF_STATIC_ASSERT(offsetof(CF_JIter, parent) == offsetof(yyjson_mut_arr_iter, arr), "CF_JIter must match yyjson_mut_arr_iter's layout");
239+
CF_STATIC_ASSERT(sizeof(CF_JIter) == sizeof(yyjson_mut_obj_iter), "CF_JIter must match yyjson_mut_obj_iter's layout");
240+
CF_STATIC_ASSERT(offsetof(CF_JIter, index) == offsetof(yyjson_mut_obj_iter, idx), "CF_JIter must match yyjson_mut_obj_iter's layout");
241+
CF_STATIC_ASSERT(offsetof(CF_JIter, count) == offsetof(yyjson_mut_obj_iter, max), "CF_JIter must match yyjson_mut_obj_iter's layout");
242+
CF_STATIC_ASSERT(offsetof(CF_JIter, val) == offsetof(yyjson_mut_obj_iter, cur), "CF_JIter must match yyjson_mut_obj_iter's layout");
243+
CF_STATIC_ASSERT(offsetof(CF_JIter, prev) == offsetof(yyjson_mut_obj_iter, pre), "CF_JIter must match yyjson_mut_obj_iter's layout");
244+
CF_STATIC_ASSERT(offsetof(CF_JIter, parent) == offsetof(yyjson_mut_obj_iter, obj), "CF_JIter must match yyjson_mut_obj_iter's layout");
245245

246246
CF_JIter cf_json_iter(CF_JVal val_handle)
247247
{

0 commit comments

Comments
 (0)