Skip to contentSkip to conversation

use lookup_macro() in handle_undef()

PATCH New Oleg Nesterov 1 participant 1 message Sep 4, 2006 Sparse checker

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 use lookup_macro() in handle_undef()

The current code looks strange, I think it used to remove the symbol from ->symbols list some time ago.

pre-process.c renamed from pre-process.c~1HUCL +5 -10
@@ -1126,22 +1126,17 @@ static int handle_weak_define(struct str
 static 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;
 }
 
Signature · 1 line
VGER BF report: H 0.0167159