]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.dg/attr-alloc_align-4.c
Update copyright years.
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / attr-alloc_align-4.c
CommitLineData
1d249509
MS
1/* PR middle-end/81871 - bogus attribute alloc_align accepted
2 { dg-do compile }
3 { dg-options "-Wall" } */
4
5#define ALIGN(N) __attribute__ ((alloc_align (N)))
6#define SIZE_MAX __SIZE_MAX__
7
8ALIGN (1) void fvv_m1 (void); /* { dg-warning ".alloc_align. attribute ignored on a function returning .void." } */
9
10ALIGN (1) int fiv_1 (void); /* { dg-warning ".alloc_align. attribute ignored on a function returning .int." } */
11
12ALIGN (0) void* fpvv_0 (void); /* { dg-warning ".alloc_align. attribute argument value .0. does not refer to a function parameter" } */
13
14ALIGN (1) void* fpvv_1 (void); /* { dg-warning ".alloc_align. attribute argument value .1. exceeds the number of function parameters 0" } */
15
16ALIGN (2) void* fii_2 (int); /* { dg-warning ".alloc_align. attribute argument value .2. exceeds the number of function parameters 1" } */
17
18ALIGN (1) void fvi_1 (int); /* { dg-warning ".alloc_align. attribute ignored on a function returning .void." } */
19
20/* Using alloc_align with a function returning a pointer to a function
21 should perhaps trigger a warning. */
22typedef void (F)(void);
23ALIGN (1) F* fpF_i_1 (int);
24
25ALIGN (SIZE_MAX) void*
26fpvi_szmax (int); /* { dg-warning ".alloc_align. attribute argument value .\[0-9\]+. exceeds the number of function parameters 1" } */
27
28ALIGN ("1") void*
29fpvi_str_1 (int); /* { dg-warning ".alloc_align. attribute argument has type .char\\\[2]" } */
30
31ALIGN ((void*)0) void*
32fpvi_pv0 (int); /* { dg-warning ".alloc_align. attribute argument has type .void \\\*." } */
33
34ALIGN ((double*)1) void*
35fpvi_pd1 (int); /* { dg-warning ".alloc_align. attribute argument has type .double \\\*." } */
36
37ALIGN (1) void*
38fpvi_pv_1 (void*); /* { dg-warning ".alloc_align. attribute argument value .1. refers to parameter type .void \\\*." } */
39
40struct S { int i; };
41ALIGN (2) void*
42fpvi_S_2 (int, struct S); /* { dg-warning ".alloc_align. attribute argument value .2. refers to parameter type .struct S." } */
43