2009-03-24 10:24:46 +08:00
|
|
|
// RUN: clang-cc %s -verify -fsyntax-only
|
2008-03-03 11:28:21 +08:00
|
|
|
|
|
|
|
int f() __attribute__((deprecated));
|
|
|
|
void g() __attribute__((deprecated));
|
|
|
|
void g();
|
|
|
|
|
2009-02-13 16:22:04 +08:00
|
|
|
void z() __attribute__((bogusattr)); // expected-warning {{'bogusattr' attribute ignored}}
|
2008-03-03 11:28:21 +08:00
|
|
|
|
|
|
|
extern int var __attribute__((deprecated));
|
|
|
|
|
|
|
|
int a() {
|
|
|
|
int (*ptr)() = f; // expected-warning {{'f' is deprecated}}
|
|
|
|
f(); // expected-warning {{'f' is deprecated}}
|
|
|
|
|
|
|
|
// test if attributes propagate to functions
|
|
|
|
g(); // expected-warning {{'g' is deprecated}}
|
|
|
|
|
|
|
|
return var; // expected-warning {{'var' is deprecated}}
|
|
|
|
}
|
|
|
|
|
|
|
|
// test if attributes propagate to variables
|
|
|
|
extern int var;
|
|
|
|
int w() {
|
|
|
|
return var; // expected-warning {{'var' is deprecated}}
|
|
|
|
}
|
2009-02-14 16:27:44 +08:00
|
|
|
|
|
|
|
int old_fn() __attribute__ ((deprecated));
|
|
|
|
int old_fn();
|
|
|
|
int (*fn_ptr)() = old_fn; // expected-warning {{'old_fn' is deprecated}}
|
|
|
|
|
|
|
|
int old_fn() {
|
2009-02-15 09:38:09 +08:00
|
|
|
return old_fn()+1; // no warning, deprecated functions can use deprecated symbols.
|
2009-02-14 16:27:44 +08:00
|
|
|
}
|
|
|
|
|
2009-02-17 01:07:21 +08:00
|
|
|
|
|
|
|
struct foo {
|
|
|
|
int x __attribute__((deprecated));
|
|
|
|
};
|
|
|
|
|
|
|
|
void test1(struct foo *F) {
|
|
|
|
++F->x; // expected-warning {{'x' is deprecated}}
|
|
|
|
}
|
2009-02-17 01:19:12 +08:00
|
|
|
|
2009-02-17 06:07:16 +08:00
|
|
|
typedef struct foo foo_dep __attribute__((deprecated));
|
|
|
|
foo_dep *test2; // expected-warning {{'foo_dep' is deprecated}}
|