aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/parse.c
diff options
authorChristopher Li <sparse@chrisli.org>2014-08-02 10:56:59 -0700
committerChristopher Li <sparse@chrisli.org>2014-08-02 10:56:59 -0700
commit7abd8a76b4e07ad60b5262e4c7858e638467fab8 (patch)
tree125c872e01e31fcd0a5f90e8cd2f9512016000bf /parse.c
parent748b856ed3e7b63faed20ed6f64dfb12371e3cf3 (diff)
downloadsparse-dev-7abd8a76b4e07ad60b5262e4c7858e638467fab8.tar.gz
Make same_symbol list share the same scope
Consider the following case, extern inline declare after extern declare of the same function. extern int g(int); extern __inline__ int g(int x) { return x; } Sparse will give the first function global scope and the second one file scope. Also the first one will get the function body from the second one. That cause the failure of the validation/extern-inlien.c This change rebind the scope of the same_symbol chain to the new scope. It will pass the extern-inline.c test case. Signed-off-by: Christopher Li <sparse@chrisli.org>
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/parse.c b/parse.c
index 55a57a74..eaa18838 100644
--- a/parse.c
+++ b/parse.c
@@ -2611,6 +2611,7 @@ static struct token *parse_function_body(struct token *token, struct symbol *dec
info(prev->definition->pos, " the previous one is here");
} else {
while (prev) {
+ rebind_scope(prev, decl->scope);
prev->definition = decl;
prev = prev->same_symbol;
}