mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 22:06:38 +00:00

The comment here was introduced in a3e01cf822f7415337e5424af3c6f4c94a12c1b9 and suggests that we should handle declaration statements and non-declaration statements the same, but don't because ProhibitAttributes() can't handle GNU attributes. That has recently changed, so remove the comment and handle all statements the same. Differential Revision: https://reviews.llvm.org/D99936
27 lines
782 B
C++
27 lines
782 B
C++
// 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
|
|
__attribute__((unused)) // expected-error {{an attribute list cannot appear here}}
|
|
#pragma weak unused_local_static
|
|
;
|
|
}
|
|
|
|
void h() {
|
|
D:
|
|
#pragma weak unused_local_static
|
|
__attribute__((unused)) // expected-error {{'unused' attribute cannot be applied to a statement}}
|
|
;
|
|
}
|
|
}
|