2009-03-24 10:24:46 +08:00
|
|
|
// RUN: clang-cc %s -fsyntax-only -verify
|
2009-02-14 15:37:35 +08:00
|
|
|
// rdar://6587766
|
|
|
|
|
|
|
|
int fn1() __attribute__ ((warn_unused_result));
|
|
|
|
int fn2() __attribute__ ((pure));
|
|
|
|
int fn3() __attribute__ ((const));
|
|
|
|
|
|
|
|
int foo() {
|
|
|
|
if (fn1() < 0 || fn2(2,1) < 0 || fn3(2) < 0) // no warnings
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
fn1(); // expected-warning {{expression result unused}}
|
|
|
|
fn2(92, 21); // expected-warning {{expression result unused}}
|
|
|
|
fn3(42); // expected-warning {{expression result unused}}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int bar __attribute__ ((warn_unused_result)); // expected-warning {{warning: 'warn_unused_result' attribute only applies to function types}}
|
|
|
|
|