Linux SPARSE checker discussions
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Linus Torvalds <torvalds@osdl.org>
Cc: linux-sparse@vger.kernel.org, Josh Triplett <josht@us.ibm.com>,
	Al Viro <viro@zeniv.linux.org.uk>
Subject: [PATCH 1/4] use lookup_macro() in handle_undef()
Date: Mon, 4 Sep 2006 19:41:35 +0400	[thread overview]
Message-ID: <20060904154135.GA6424@oleg> (raw)

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

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

--- git-snapshot-20060904/pre-process.c~1HUCL	2006-09-03 23:32:31.000000000 +0400
+++ git-snapshot-20060904/pre-process.c	2006-09-04 17:19:51.000000000 +0400
@@ -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;
 }
 


-- 
VGER BF report: H 0.0167159

                 reply	other threads:[~2006-09-04 11:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060904154135.GA6424@oleg \
    --to=oleg@tv-sign.ru \
    --cc=josht@us.ibm.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=torvalds@osdl.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox