From 04a732881a38c2e67c2662ab136ef143e4cba96d Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 5 Sep 2024 14:22:39 -0700 Subject: [PATCH] Add a test to verify structure alignment --- include/SDL3/SDL_stdinc.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/SDL3/SDL_stdinc.h b/include/SDL3/SDL_stdinc.h index 6fb09b1a7f..646bbd7884 100644 --- a/include/SDL3/SDL_stdinc.h +++ b/include/SDL3/SDL_stdinc.h @@ -494,6 +494,12 @@ SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4); SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4); SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8); SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); +typedef struct SDL_alignment_test +{ + Uint8 a; + void *b; +} SDL_alignment_test; +SDL_COMPILE_TIME_ASSERT(struct_alignment, sizeof(SDL_alignment_test) == (2 * sizeof(void *))); #endif /* DOXYGEN_SHOULD_IGNORE_THIS */ /** \endcond */