| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify -triple bpf-pc-linux-gnu %s |
| 2 |
|
| 3 |
#define __pso __attribute__((preserve_static_offset)) |
| 4 |
|
| 5 |
// These are correct usages. |
| 6 |
struct foo { int a; } __pso; |
| 7 |
union quux { int a; } __pso; |
| 8 |
struct doug { int a; } __pso __attribute__((packed)); |
| 9 |
|
| 10 |
// Rest are incorrect usages. |
| 11 |
typedef int bar __pso; // expected-error{{attribute only applies to}} |
| 12 |
struct goo { |
| 13 |
int a __pso; // expected-error{{attribute only applies to}} |
| 14 |
}; |
| 15 |
int g __pso; // expected-error{{attribute only applies to}} |
| 16 |
__pso void ffunc1(void); // expected-error{{attribute only applies to}} |
| 17 |
void ffunc2(int a __pso); // expected-error{{attribute only applies to}} |
| 18 |
void ffunc3(void) { |
| 19 |
int a __pso; // expected-error{{attribute only applies to}} |
| 20 |
} |
| 21 |
|
| 22 |
struct buz { int a; } __attribute__((preserve_static_offset("hello"))); // \ |
| 23 |
expected-error{{attribute takes no arguments}} |