dissect: teach do_initializer() to handle the nested EXPR_IDENTIFIER's
commitba83e861566d75132074fabfc96eff5e30e34297
authorOleg Nesterov <oleg@redhat.com>
Mon, 8 Feb 2016 15:13:28 +0000 (8 16:13 +0100)
committerChristopher Li <sparse@chrisli.org>
Mon, 13 Feb 2017 01:34:43 +0000 (13 09:34 +0800)
treea25f02c7ed452ab3cd10816c87b573ee2c83f78f
parentdced7bc871c4f3eab293e153a9714c39cb469d43
dissect: teach do_initializer() to handle the nested EXPR_IDENTIFIER's

do_initializer() is very limited/buggy but it was able to parse the kernel
code until ftrace started to use ".a.b = x" rather than ".a = { .b = x }"
in initializers.

Test-case:

struct O {
struct I {
int mem;
} inn;
int end;
} var = {
.inn.mem = 0,
0,
};

before the patch:

1:8   s def  O
2:16  s def  I
6:3   g def  var                              struct O
6:3   g -w-  var                              struct O
7:10  s -w-  O.inn                            struct I
7:10  s -w-  I.*                              struct I
I.c:7:14: warning: bad expr->type: 25
8:9   s -w-  O.end                            int

after:

1:8   s def  O
2:16  s def  I
6:3   g def  var                              struct O
6:3   g -w-  var                              struct O
7:10  s -w-  O.inn                            struct I
7:14  s -w-  I.mem                            int
8:9   s -w-  O.end                            int

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Christopher Li <sparse@chrisli.org>
dissect.c