blob: a6e9ad6f10b168e22f53467ee58dcc7a9f5a82d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
/*
test C2X memalignment.
type: char, int, long, long long
*/
#include <testfwk.h>
#ifdef __SDCC
#pragma std_c23
#include <stdlib.h>
size_t memalignment(const void *p); // TODO: Rely on stdlib.h instead once the preprocessor can handle the option for C2X.
{type} c;
#endif
void
testMemalign(void)
{
#ifdef __SDCC
ASSERT(memalignment(0) == 0);
ASSERT(memalignment(&c) > 0);
ASSERT(memalignment(&c) >= _Alignof({type}));
#endif
}
|