From: Al Viro <viro@ftp.linux.org.uk>
To: Pavel Roskin <proski@gnu.org>
Cc: linux-sparse@vger.kernel.org
Subject: Re: Structures from -include are "weak"
Date: Sun, 8 Jul 2007 06:42:18 +0100 [thread overview]
Message-ID: <20070708054218.GD21668@ftp.linux.org.uk> (raw)
In-Reply-To: <1183865570.12651.18.camel@gx>
On Sat, Jul 07, 2007 at 11:32:50PM -0400, Pavel Roskin wrote:
> It looks like the definition of struct st is sort of "weak" when it's
> read from the header included on the command line, so that the forward
> declaration from test.c removes the original definition.
>
> It's also possible to define struct st to something else, and sparse
> won't warn about it. But omitting "struct st;" fixes the error, so the
> original definition is known to sparse.
Looks like it gets a scope boundary between those. There is one case
when presense of struct st; changes things: struct st; in
struct st {....};
....
{
struct st;
struct st *p;
...
struct st {....} x;
...
}
will make p a pointer to struct st from that scope. If you omit it,
p will be a pointer to struct st from the outer scope and x will have
a different type. Too late beginning of file scope, perhaps?
next prev parent reply other threads:[~2007-07-08 5:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-08 3:32 Structures from -include are "weak" Pavel Roskin
2007-07-08 5:42 ` Al Viro [this message]
2007-07-08 6:06 ` Al Viro
2007-07-08 6:25 ` Pavel Roskin
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=20070708054218.GD21668@ftp.linux.org.uk \
--to=viro@ftp.linux.org.uk \
--cc=linux-sparse@vger.kernel.org \
--cc=proski@gnu.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;
as well as URLs for NNTP newsgroup(s).