1*1f5207b7SJohn Levon typedef unsigned long int size_t;
2*1f5207b7SJohn Levon 
3*1f5207b7SJohn Levon /*
4*1f5207b7SJohn Levon  * The alloc_align attribute is used to tell the compiler that the return
5*1f5207b7SJohn Levon  * value points to memory, where the returned pointer minimum alignment is given
6*1f5207b7SJohn Levon  * by one of the functions parameters. GCC uses this information to improve
7*1f5207b7SJohn Levon  * pointer alignment analysis.
8*1f5207b7SJohn Levon  *
9*1f5207b7SJohn Levon  * The function parameter denoting the allocated alignment is specified by one
10*1f5207b7SJohn Levon  * integer argument, whose number is the argument of the attribute. Argument
11*1f5207b7SJohn Levon  * numbering starts at one.
12*1f5207b7SJohn Levon  *
13*1f5207b7SJohn Levon  * For instance,
14*1f5207b7SJohn Levon  *
15*1f5207b7SJohn Levon  *    void* my_memalign(size_t, size_t) __attribute__((alloc_align(1)))
16*1f5207b7SJohn Levon  *
17*1f5207b7SJohn Levon  * declares that my_memalign returns memory with minimum alignment given by
18*1f5207b7SJohn Levon  * parameter 1.
19*1f5207b7SJohn Levon  */
20*1f5207b7SJohn Levon 
21*1f5207b7SJohn Levon #define __alloc_align(x)  __attribute__((__alloc_align__(x)))
22*1f5207b7SJohn Levon 
23*1f5207b7SJohn Levon /*
24*1f5207b7SJohn Levon  * The aligned_alloc function allocates space for an object whose alignment is
25*1f5207b7SJohn Levon  * specified by alignment, whose size is specified by size, and whose value is
26*1f5207b7SJohn Levon  * indeterminate. The value of alignment shall be a valid alignment supported
27*1f5207b7SJohn Levon  * by the implementation and the value of size shall be an integral multiple
28*1f5207b7SJohn Levon  * of alignment.
29*1f5207b7SJohn Levon  *
30*1f5207b7SJohn Levon  * The aligned_alloc function returns either a null pointer or a pointer to the
31*1f5207b7SJohn Levon  * allocated space.
32*1f5207b7SJohn Levon  */
33*1f5207b7SJohn Levon void *aligned_alloc(size_t alignment, size_t size) __alloc_align(1);
34*1f5207b7SJohn Levon 
35*1f5207b7SJohn Levon 
36*1f5207b7SJohn Levon /*
37*1f5207b7SJohn Levon  * check-name: attribute __alloc_align__
38*1f5207b7SJohn Levon  */
39