Richard Smith | c392617 | 2014-04-02 18:28:36 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -Wunused-variable -Wunused-label -verify %s |
| 2 | |
| 3 | static int unused_local_static; |
| 4 | |
| 5 | namespace PR8455 { |
| 6 | void f() { |
| 7 | A: // expected-warning {{unused label 'A'}} |
| 8 | __attribute__((unused)) int i; // attribute applies to variable |
| 9 | B: // attribute applies to label |
| 10 | __attribute__((unused)); int j; // expected-warning {{unused variable 'j'}} |
| 11 | } |
| 12 | |
| 13 | void g() { |
| 14 | C: // unused label 'C' will not appear here because an error has occurred |
| 15 | __attribute__((unused)) |
| 16 | #pragma weak unused_local_static // expected-error {{expected ';' after __attribute__}} |
| 17 | ; |
| 18 | } |
| 19 | |
| 20 | void h() { |
| 21 | D: // expected-warning {{unused label 'D'}} |
| 22 | #pragma weak unused_local_static |
| 23 | __attribute__((unused)) // expected-warning {{declaration does not declare anything}} |
| 24 | ; |
| 25 | } |
| 26 | } |