Linux SPARSE checker discussions
 help / color / mirror / Atom feed
From: Pavel Roskin <proski@gnu.org>
To: linux-sparse@vger.kernel.org
Subject: Please make "no member" error more informative
Date: Thu, 31 May 2007 01:30:21 -0400	[thread overview]
Message-ID: <1180589421.4159.58.camel@dv> (raw)

Hello!

sparse reports the same error for two different situations.  Suppose
file test.c is:

struct ctl_table {
	int foo;
};

void test(struct ctl_table *sc)
{
	sc->ctl_name = 0;
}

$ sparse -Wall test.c 
test.c:7:4: error: no member 'ctl_name' in struct ctl_table

Rename the first ctl_table to ctl_table1, and the error will be the
same.

In the first case, the structure is known and lacks the requested
member.  In the second case, the structure is unknown.

I'll appreciate if somebody makes the messages different.  The message
is printed in evaluate_member_dereference() in evaluate.c.

Please test the case when only a forward declaration is available.  This
should be reported like the undeclared case.  Another test case is a
structure with no members.  It should be treated as declared.

-- 
Regards,
Pavel Roskin

                 reply	other threads:[~2007-05-31  5:30 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=1180589421.4159.58.camel@dv \
    --to=proski@gnu.org \
    --cc=linux-sparse@vger.kernel.org \
    /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