brintos

brintos / llvm-project-archived public Read only

0
0
Text · 782 B · ceef889 Raw
27 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -Wunused-variable -Wunused-label -verify %s2 3static int unused_local_static;4 5namespace PR8455 {6  void f() {7    A: // expected-warning {{unused label 'A'}}8      __attribute__((unused)) int i; // attribute applies to variable9    B: // attribute applies to label10      __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 occurred15      __attribute__((unused)) // expected-error {{an attribute list cannot appear here}}16      #pragma weak unused_local_static17      ;18  }19 20  void h() {21  D:22#pragma weak unused_local_static23    __attribute__((unused)) // expected-error {{'unused' attribute cannot be applied to a statement}}24    ;25  }26}27