Print this page
11972 resync smatch
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/tools/smatch/src/validation/constexpr-addr-of-static.c
+++ new/usr/src/tools/smatch/src/validation/constexpr-addr-of-static.c
1 1 static int a = 1;
2 2 static int b[2] = {1, 1};
3 3 static void c(void) {}
4 4
5 5 static int *d = &a; // OK
6 6 static int *e = d; // KO
7 7 static int *f = b; // OK
8 8
9 9 static void (*g)(void) = c; // OK
10 10 static void (*h)(void) = &c; // OK
11 11
12 12 static int *i = &*&a; // OK
13 13 static int *j = &*b; // OK
14 14 static int *k = &*d; // KO
15 15
16 16
17 17 static void l(void) {
↓ open down ↓ |
17 lines elided |
↑ open up ↑ |
18 18 int a = 1;
19 19 static int *b = &a; // KO
20 20 }
21 21
22 22 static void m(void) {
23 23 static int a = 1;
24 24 static int *b = &a; // OK
25 25 }
26 26
27 27 /*
28 - * check-name: address of static object constness verification.
28 + * check-name: constexpr static object address
29 29 * check-command: sparse -Wconstexpr-not-const $file
30 30 *
31 31 * check-error-start
32 32 constexpr-addr-of-static.c:6:17: warning: non-constant initializer for static object
33 33 constexpr-addr-of-static.c:14:19: warning: non-constant initializer for static object
34 34 constexpr-addr-of-static.c:19:26: warning: non-constant initializer for static object
35 35 * check-error-end
36 36 */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX