aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-04-18 16:37:32 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-05-21 17:27:45 +0200
commitc1b89f892ebef693da906685cd72c39f1f38c8ff (patch)
treeb2977c931d32b9d22aa50c43c195c5b551f054c2
parent91de00e92952a61a745be95c56e8595b506d866a (diff)
downloadsparse-c1b89f892ebef693da906685cd72c39f1f38c8ff.tar.gz
scope: __func__ is special
__func__ needs to be in the namepsace for symbols: NS_SYMBOL but doesn't follow the usual scope rules of them: it always needs to be declared in the function scope. So, use bind_symbol_with_scope() instead of first using bind_symbol() and then changing the namespace. Also change the comment to better express that it's the scope that is the unusual thing. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--expression.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/expression.c b/expression.c
index 78e577cf..ffb3c2dc 100644
--- a/expression.c
+++ b/expression.c
@@ -122,9 +122,8 @@ static struct symbol *handle_func(struct token *token)
decl->ctype.modifiers = MOD_STATIC;
decl->endpos = token->pos;
- /* function-scope, but in NS_SYMBOL */
- bind_symbol(decl, ident, NS_LABEL);
- decl->namespace = NS_SYMBOL;
+ /* NS_SYMBOL but in function-scope */
+ bind_symbol_with_scope(decl, ident, NS_SYMBOL, function_scope);
len = current_fn->ident->len;
string = __alloc_string(len + 1);