attr-used.c 632 B

1234567891011121314151617181920
  1. // RUN: %clang_cc1 -verify -fsyntax-only -Wno-private-extern %s
  2. extern int l0 __attribute__((used)); // expected-warning {{'used' attribute ignored}}
  3. __private_extern__ int l1 __attribute__((used)); // expected-warning {{'used' attribute ignored}}
  4. struct __attribute__((used)) s { // expected-warning {{'used' attribute only applies to variables and functions}}
  5. int x;
  6. };
  7. int a __attribute__((used));
  8. static void __attribute__((used)) f0(void) {
  9. }
  10. void f1() {
  11. static int a __attribute__((used));
  12. int b __attribute__((used)); // expected-warning {{'used' attribute ignored}}
  13. }
  14. static void __attribute__((used)) f0(void);