kpatch: use git instead of trying to create diffs by hand
[smatch.git] / validation / constexpr-addr-of-static.c
bloba3af99ae7255c203c1f997fe2dd3c5d75eba6428
1 static int a = 1;
2 static int b[2] = {1, 1};
3 static void c(void) {}
5 static int *d = &a; // OK
6 static int *e = d; // KO
7 static int *f = b; // OK
9 static void (*g)(void) = c; // OK
10 static void (*h)(void) = &c; // OK
12 static int *i = &*&a; // OK
13 static int *j = &*b; // OK
14 static int *k = &*d; // KO
17 static void l(void) {
18 int a = 1;
19 static int *b = &a; // KO
22 static void m(void) {
23 static int a = 1;
24 static int *b = &a; // OK
28 * check-name: address of static object constness verification.
29 * check-command: sparse -Wconstexpr-not-const $file
31 * check-error-start
32 constexpr-addr-of-static.c:6:17: warning: non-constant initializer for static object
33 constexpr-addr-of-static.c:14:19: warning: non-constant initializer for static object
34 constexpr-addr-of-static.c:19:26: warning: non-constant initializer for static object
35 * check-error-end