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

This also clarifies some terminology used by the diagnostic (methods -> Objective-C methods, fields -> non-static data members, etc). Many of the tests needed to be updated in multiple places for the diagnostic wording tweaks. The first instance of the diagnostic for that attribute is fully specified and subsequent instances cut off the complete list (to make it easier if additional subjects are added in the future for the attribute). llvm-svn: 319002
21 lines
472 B
C++
21 lines
472 B
C++
// RUN: %clang_cc1 -fsyntax-only -Wunused-variable -verify %s
|
|
struct __attribute__((warn_unused)) Test {
|
|
Test();
|
|
~Test();
|
|
void use();
|
|
};
|
|
|
|
struct TestNormal {
|
|
TestNormal();
|
|
};
|
|
|
|
int main(void) {
|
|
Test unused; // expected-warning {{unused variable 'unused'}}
|
|
Test used;
|
|
TestNormal normal;
|
|
used.use();
|
|
|
|
int i __attribute__((warn_unused)) = 12; // expected-warning {{'warn_unused' attribute only applies to structs, unions, and classes}}
|
|
return i;
|
|
}
|