struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / align.c.in
blob6e78cbcc62cdddf2138d2c9a7905fdebe85b5c81
1 /** Tests covering alignment operators.
3 sign: signed, unsigned
4 type: char, int, long
5 */
7 #include <testfwk.h>
9 #include <stddef.h>
11 #if defined (__SDCC) || __STDC_VERSION__ >= 201112L
12 #include <stdalign.h>
13 char alignas (0) alignas({sign} {type}) a;
14 char alignas (int) alignas({sign} {type}) alignas(long) b;
15 char alignas ({sign} {type}) alignas(0) c;
16 #endif
18 void
19 testAlignof(void)
21 #if defined (__SDCC) || __STDC_VERSION__ >= 201112L
22 ASSERT(alignof(char) <= alignof({sign} {type}));
23 ASSERT(alignof({sign} {type}) <= alignof(max_align_t));
25 #ifdef __SDCC
26 /* sdcc currently only supports architectures that do not have alignment restrictions. */
27 ASSERT(alignof({sign} {type}) == 1);
28 ASSERT(alignof(max_align_t) == 1);
29 #endif
30 #endif