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