| 1 |
/* PR middle-end/97879 - ICE on invalid mode in attribute access |
| 2 |
{ dg-do compile } |
| 3 |
{ dg-options "-Wall" } */ |
| 4 |
|
| 5 |
#define A(...) __attribute__ ((access (__VA_ARGS__))) |
| 6 |
|
| 7 |
A (" ", 1) void f1 (int *); // { dg-error "attribute 'access' mode '\" \"' is not an identifier; expected one of 'read_only', 'read_write', 'write_only', or 'none'" } |
| 8 |
void f1 (int *); |
| 9 |
|
| 10 |
|
| 11 |
A ("none", 1) void f2 (char *); // { dg-error "not an identifier" } |
| 12 |
void f2 (char *); |
| 13 |
|
| 14 |
A (1) void f3 (); // { dg-error "not an identifier" } |
| 15 |
|
| 16 |
A (1, 2) void f4 (); // { dg-error "not an identifier" } |
| 17 |
A (2., 3.) void f5 (); // { dg-error "not an identifier" } |
| 18 |
|
| 19 |
// Verify that copying a valid access attribute doesn't cause errors. |
| 20 |
A (read_only, 1, 2) void f6 (void*, int); |
| 21 |
__attribute__ ((copy (f6))) void f7 (void*, int); |