mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-27 17:36:05 +00:00
Warn about attribute used ignored on "extern int a
__attribute__((used))". llvm-svn: 64499
This commit is contained in:
parent
0818b26362
commit
311bf2916b
@ -439,7 +439,7 @@ static void HandleUsedAttr(Decl *d, const AttributeList &Attr, Sema &S) {
|
||||
}
|
||||
|
||||
if (const VarDecl *VD = dyn_cast<VarDecl>(d)) {
|
||||
if (VD->hasLocalStorage()) {
|
||||
if (VD->hasLocalStorage() || VD->hasExternalStorage()) {
|
||||
S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "used";
|
||||
return;
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
// RUN: clang -verify -fsyntax-only %s
|
||||
|
||||
extern int l0 __attribute__((used)); // expected-warning {{used attribute ignored}}
|
||||
__private_extern__ int l1 __attribute__((used)); // expected-warning {{used attribute ignored}}
|
||||
|
||||
struct __attribute__((used)) s { // expected-warning {{'used' attribute only applies to variable and function types}}
|
||||
int x;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user