aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2020-02-04 17:51:42 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-02-06 03:36:29 +0100
commitc6adc489224b4c1c5929ac83b8a904f1733a7ba4 (patch)
tree00984881961adf7e3fae0da44105a1bf9d8c1939
parentcac470f792eb320c243f5084f609276380fd539d (diff)
downloadsparse-c6adc489224b4c1c5929ac83b8a904f1733a7ba4.tar.gz
dissect: change deanon() to handle the !node case
Change deanon() to always initialize base->ident when parent != NULL but still return false to avoid the pointless ->r_symdef(). Test-case: struct { union { int x; }; } var = { { .x = 0 }, }; before this patch: 1:8 s def :var 5:3 g def var struct :var 5:3 g -w- var struct :var 6:12 s -w- ?.x int after: 1:8 s def :var 5:3 g def var struct :var 5:3 g -w- var struct :var 6:12 s -w- :var.x int Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--dissect.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/dissect.c b/dissect.c
index d34b38af..57dcdb29 100644
--- a/dissect.c
+++ b/dissect.c
@@ -195,8 +195,10 @@ static bool deanon(struct symbol *base, struct ident *node, struct symbol *paren
struct ident *pi = parent ? parent->ident : NULL;
char name[256];
- if (!node)
+ if (!node) {
+ base->ident = pi;
return false;
+ }
snprintf(name, sizeof(name), "%.*s:%.*s",
pi ? pi->len : 0, pi ? pi->name : NULL, node->len, node->name);