linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Christopher Li" <sparse@chrisli.org>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Al Viro <viro@zeniv.linux.org.uk>, linux-sparse@vger.kernel.org
Subject: Re: Casting away noderef and address spaces?
Date: Mon, 22 Dec 2008 19:02:58 -0800	[thread overview]
Message-ID: <70318cbf0812221902q23f00644h3af3eed6fa0138de@mail.gmail.com> (raw)
In-Reply-To: <200812231244.22614.rusty@rustcorp.com.au>

[-- Attachment #1: Type: text/plain, Size: 388 bytes --]

On Mon, Dec 22, 2008 at 6:14 PM, Rusty Russell <rusty@rustcorp.com.au> wrote:
> rusty@vivaldi:/tmp$ sparse foo.c
> foo.c:11:20: warning: incorrect type in assignment (invalid types)
> foo.c:11:20:    expected unknown type 11<noident>
> foo.c:11:20:    got int
>

I think you need this patch for sparse. The version of sparse you
have does not handle typeof based type compare yet.

Chris

[-- Attachment #2: evaluate-typeof --]
[-- Type: application/octet-stream, Size: 594 bytes --]

Teach classify_type to handle typeof

Signed-Off-By: Christopher Li <sparse@chrisli.org>

Index: sparse/evaluate.c
===================================================================
--- sparse.orig/evaluate.c
+++ sparse/evaluate.c
@@ -362,6 +362,11 @@ static inline int classify_type(struct s
 	};
 	if (type->type == SYM_NODE)
 		type = type->ctype.base_type;
+	if (type->type == SYM_TYPEOF) {
+		type = evaluate_expression(type->initializer);
+		if (type->type == SYM_NODE)
+			type = type->ctype.base_type;
+	}
 	if (type->type == SYM_ENUM)
 		type = type->ctype.base_type;
 	*base = type;

      reply	other threads:[~2008-12-23  3:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-22  5:36 Casting away noderef and address spaces? Rusty Russell
2008-12-22 20:06 ` Christopher Li
2008-12-22 20:57   ` Al Viro
2008-12-22 21:23     ` Christopher Li
2008-12-22 21:39       ` Al Viro
2008-12-22 22:33         ` Christopher Li
2008-12-22 22:42           ` Harvey Harrison
2008-12-22 22:57           ` Sam Ravnborg
2008-12-22 23:53             ` Alexey Zaytsev
2008-12-22 23:55               ` Johannes Berg
2008-12-23  0:20                 ` Alexey Zaytsev
2008-12-23  0:35                   ` Johannes Berg
2008-12-23  0:37                   ` Johannes Berg
2008-12-23  1:25                     ` Christopher Li
2008-12-23  9:59                       ` Johannes Berg
2008-12-24  8:34                         ` Christopher Li
2008-12-23  2:14     ` Rusty Russell
2008-12-23  3:02       ` Christopher Li [this message]

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=70318cbf0812221902q23f00644h3af3eed6fa0138de@mail.gmail.com \
    --to=sparse@chrisli.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --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;
as well as URLs for NNTP newsgroup(s).