| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-require-effective-target persistent } */ |
| 3 |
/* { dg-options "-Wattributes" } */ |
| 4 |
|
| 5 |
/* Check warning/error messages for "persistent" attribute misuse. */ |
| 6 |
int __attribute__((persistent)) persistent_fn (void); /* { dg-warning "ignoring 'persistent' attribute not set on a variable" } */ |
| 7 |
int __attribute__((section ("mysection"), persistent)) persistent_section1 = 1; /* { dg-warning "because it conflicts with attribute" } */ |
| 8 |
int __attribute__((persistent, section ("mysection"))) persistent_section2 = 2; /* { dg-warning "because it conflicts with attribute" } */ |
| 9 |
const int __attribute__((persistent)) persistent_const = 3; /* { dg-warning "ignoring 'persistent' attribute set on const variable" } */ |
| 10 |
int __attribute__((persistent)) persistent_init; /* { dg-warning "ignoring 'persistent' attribute set on uninitialized variable" } */ |
| 11 |
void foo (void) { int __attribute__((persistent)) local_persistent = 4; } /* { dg-error "'persistent' attribute cannot be specified for local variables" } */ |