aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/attr-deprecated.c
blob: f018c3356fc489e812034d6156a477ad01d9d91b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// RUN: clang %s -verify -fsyntax-only

int f() __attribute__((deprecated));
void g() __attribute__((deprecated));
void g();

void z() __attribute__((bogusattr)); // todo-warning {{'bogusattr' attribute ignored}}

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}}
}