diff options
| author | Ramsay Jones <ramsay@ramsayjones.plus.com> | 2016-10-06 00:49:18 +0100 |
|---|---|---|
| committer | Christopher Li <sparse@chrisli.org> | 2016-10-13 03:57:00 -0700 |
| commit | 65f90e77057687ad5a6e8196d99aaf93bd0f5443 (patch) | |
| tree | 38d5da41d3704a2929c7f6fa01b3ce39445b535d /validation | |
| parent | 153fbd0bbbfd952c6e3c1f6494e71d6ba903f7ed (diff) | |
| download | sparse-dev-65f90e77057687ad5a6e8196d99aaf93bd0f5443.tar.gz | |
sparse: add 'alloc_align' to the ignored attributes
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Christopher Li <sparse@chrisli.org>
Diffstat (limited to 'validation')
| -rw-r--r-- | validation/alloc-align.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/validation/alloc-align.c b/validation/alloc-align.c new file mode 100644 index 00000000..e414257a --- /dev/null +++ b/validation/alloc-align.c @@ -0,0 +1,38 @@ +typedef unsigned long int size_t; + +/* + * The alloc_align attribute is used to tell the compiler that the return + * value points to memory, where the returned pointer minimum alignment is given + * by one of the functions parameters. GCC uses this information to improve + * pointer alignment analysis. + * + * The function parameter denoting the allocated alignment is specified by one + * integer argument, whose number is the argument of the attribute. Argument + * numbering starts at one. + * + * For instance, + * + * void* my_memalign(size_t, size_t) __attribute__((alloc_align(1))) + * + * declares that my_memalign returns memory with minimum alignment given by + * parameter 1. + */ + +#define __alloc_align(x) __attribute__((__alloc_align__(x))) + +/* + * The aligned_alloc function allocates space for an object whose alignment is + * specified by alignment, whose size is specified by size, and whose value is + * indeterminate. The value of alignment shall be a valid alignment supported + * by the implementation and the value of size shall be an integral multiple + * of alignment. + * + * The aligned_alloc function returns either a null pointer or a pointer to the + * allocated space. + */ +void *aligned_alloc(size_t alignment, size_t size) __alloc_align(1); + + +/* + * check-name: attribute __alloc_align__ + */ |
