2013-07-20 23:05:36 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -Wunused-variable -verify %s
|
2013-11-28 00:59:17 +08:00
|
|
|
struct __attribute__((warn_unused)) Test {
|
|
|
|
Test();
|
|
|
|
~Test();
|
|
|
|
void use();
|
2013-07-20 23:05:36 +08:00
|
|
|
};
|
|
|
|
|
2013-11-28 00:59:17 +08:00
|
|
|
struct TestNormal {
|
|
|
|
TestNormal();
|
2013-07-20 23:05:36 +08:00
|
|
|
};
|
|
|
|
|
2013-11-28 00:59:17 +08:00
|
|
|
int main(void) {
|
|
|
|
Test unused; // expected-warning {{unused variable 'unused'}}
|
|
|
|
Test used;
|
|
|
|
TestNormal normal;
|
|
|
|
used.use();
|
|
|
|
|
2017-11-27 04:01:12 +08:00
|
|
|
int i __attribute__((warn_unused)) = 12; // expected-warning {{'warn_unused' attribute only applies to structs, unions, and classes}}
|
2013-11-28 00:59:17 +08:00
|
|
|
return i;
|
2013-07-20 23:05:36 +08:00
|
|
|
}
|