2014-04-03 02:28:36 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -Wunused-variable -Wunused-label -verify %s
|
|
|
|
|
|
|
|
static int unused_local_static;
|
|
|
|
|
|
|
|
namespace PR8455 {
|
|
|
|
void f() {
|
|
|
|
A: // expected-warning {{unused label 'A'}}
|
|
|
|
__attribute__((unused)) int i; // attribute applies to variable
|
|
|
|
B: // attribute applies to label
|
|
|
|
__attribute__((unused)); int j; // expected-warning {{unused variable 'j'}}
|
|
|
|
}
|
|
|
|
|
|
|
|
void g() {
|
|
|
|
C: // unused label 'C' will not appear here because an error has occurred
|
2021-04-06 17:54:02 +08:00
|
|
|
__attribute__((unused)) // expected-error {{an attribute list cannot appear here}}
|
|
|
|
#pragma weak unused_local_static
|
2014-04-03 02:28:36 +08:00
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
void h() {
|
[Attr] Support _attribute__ ((fallthrough))
Summary: Fixed extraneous matches of non-NullStmt
Reviewers: aaron.ballman, rsmith, efriedma, xbolva00
Reviewed By: aaron.ballman, rsmith, xbolva00
Subscribers: riccibruno, arphaman, ziangwan, ojeda, xbolva00, nickdesaulniers, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64838
llvm-svn: 369414
2019-08-21 01:16:49 +08:00
|
|
|
D:
|
|
|
|
#pragma weak unused_local_static
|
|
|
|
__attribute__((unused)) // expected-error {{'unused' attribute cannot be applied to a statement}}
|
|
|
|
;
|
2014-04-03 02:28:36 +08:00
|
|
|
}
|
|
|
|
}
|