struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / memalignment.c.in
bloba6e9ad6f10b168e22f53467ee58dcc7a9f5a82d2
1 /*
2 test C2X memalignment.
3 type: char, int, long, long long
4 */
6 #include <testfwk.h>
8 #ifdef __SDCC
9 #pragma std_c23
11 #include <stdlib.h>
13 size_t memalignment(const void *p); // TODO: Rely on stdlib.h instead once the preprocessor can handle the option for C2X.
14 {type} c;
15 #endif
17 void
18 testMemalign(void)
20 #ifdef __SDCC
21 ASSERT(memalignment(0) == 0);
22 ASSERT(memalignment(&c) > 0);
23 ASSERT(memalignment(&c) >= _Alignof({type}));
24 #endif