use lookup_macro() in handle_undef()
PATCH 1/7 use lookup_macro() in handle_undef()
Current code looks strange, I think it used to remove the symbol from ->symbols list some time ago.
Signed-off-by Oleg Nesterov <[email protected]>
pre-process.c renamed from pre-process.c~1_HUCL +5 -10
@@ -1126,22 +1126,17 @@ static int handle_weak_define(struct strstatic int handle_undef (struct stream *stream,struct token **line,struct token *token) {struct token *left = token->next; -struct symbol **sym; +struct symbol *sym;if (token_type (left) !=TOKEN_IDENT ) {sparse_error (token->pos,"expected identifier to 'undef'" );return 1 ; } - sym = &left->ident->symbols; -while (*sym) { -struct symbol *t = *sym; -if (t->namespace & (NS_MACRO |NS_INVISIBLEMACRO )) { - t->namespace =NS_INVISIBLEMACRO ; -return 1 ; - } - sym = &t->next_id; - } + sym =lookup_macro (left->ident); +if (sym) + sym->namespace =NS_INVISIBLEMACRO ; +return 1 ; }
Any comments?
Please note that patches 3-4 are bugfixes.
Oleg.
Josh Triplett
AppliedI've merged all 7 of these patches. Thanks again, and sorry these slipped through the cracks for for so long.
- Josh Triplett