Print this page
new smatch
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/tools/smatch/src/validation/constexpr-addr-of-static-member.c
+++ new/usr/src/tools/smatch/src/validation/constexpr-addr-of-static-member.c
1 1 struct A {
2 2 int a;
3 3 int b[2];
4 4 };
5 5
6 6 struct B {
7 7 int c;
8 8 struct A d;
9 9 };
10 10
↓ open down ↓ |
10 lines elided |
↑ open up ↑ |
11 11 static struct B a= {1, {1, {1, 1}}};
12 12
13 13 static int *b = &a.d.a; // OK
14 14 static int *c = &(&a.d)->a; // OK
15 15 static int *d = a.d.b; // OK
16 16 static int *e = (&a.d)->b; // OK
17 17 static int *f = &a.d.b[1]; // OK
18 18 static int *g = &(&a.d)->b[1]; // OK
19 19
20 20 /*
21 - * check-name: address of static object's member constness verification.
21 + * check-name: constexpr static object's member address
22 22 * check-command: sparse -Wconstexpr-not-const $file
23 23 *
24 24 * check-error-start
25 25 * check-error-end
26 26 */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX