From f1d1079faf3401831f05d2e44d3c16c68dafafb9 Mon Sep 17 00:00:00 2001 From: Nic Barker Date: Sat, 28 Sep 2024 21:59:55 +1200 Subject: [PATCH] more fixes to bad macros --- clay.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/clay.h b/clay.h index 7bc5e5d..8d49169 100644 --- a/clay.h +++ b/clay.h @@ -112,6 +112,14 @@ static int CLAY__ELEMENT_DEFINITION_LATCH = 0; children \ Clay__CloseElementWithChildren() +#ifdef __cplusplus +#define CLAY__ALIGNMENT(type) alignof(type) +#define CLAY__INIT(type) type +#else +#define CLAY__INIT(type) (type) +#define CLAY__ALIGNMENT(type) (offsetof(struct { char c; type x; }, x)) +#endif + #ifdef __cplusplus extern "C" { #endif @@ -452,14 +460,6 @@ extern uint32_t Clay__debugViewWidth; #define CLAY__MAX(x, y) (((x) > (y)) ? (x) : (y)) #define CLAY__MIN(x, y) (((x) < (y)) ? (x) : (y)) -#ifdef __cplusplus -#define CLAY__ALIGNMENT(type) alignof(type) -#define CLAY__INIT(type) type -#else -#define CLAY__INIT(type) (type) -#define CLAY__ALIGNMENT(type) (offsetof(struct { char c; type x; }, x)) -#endif - bool Clay__warningsEnabled = true; Clay_String CLAY__SPACECHAR = CLAY__INIT(Clay_String) { .length = 1, .chars = " " };