From: josh@joshtriplett.org
To: linux-sparse@vger.kernel.org
Subject: Designated initializers for fields in anonymous structs and unions
Date: Thu, 31 Jul 2014 11:10:06 -0700 [thread overview]
Message-ID: <20140731181006.GA13180@cloud> (raw)
GCC 4.6 and newer support initializing designated initializers for fields in
anonymous structs and unions. However, sparse does not. Test case:
union U {
int a;
struct {
int b;
int c;
};
};
static union U u = {
.b = 0,
.c = 0,
};
struct S {
int a;
union {
int b;
int c;
};
};
static struct S s = {
.a = 0,
.b = 0,
};
GCC handles this just fine; sparse says:
test.c:10:6: error: unknown field name in initializer
test.c:11:6: error: unknown field name in initializer
test.c:24:6: error: unknown field name in initializer
Sparse needs to handle this, and we should add the above as a test case.
(We also need an appropriate extension to the test for
__attribute__((designated_init)).)
- Josh Triplett
next reply other threads:[~2014-07-31 18:10 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-31 18:10 josh [this message]
2014-07-31 18:39 ` Designated initializers for fields in anonymous structs and unions Linus Torvalds
2014-07-31 18:50 ` Linus Torvalds
2014-07-31 20:55 ` josh
2014-08-02 8:27 ` Christopher Li
2014-08-02 18:09 ` Christopher Li
2014-08-01 2:19 ` Linus Torvalds
2014-08-01 2:41 ` Linus Torvalds
2014-08-02 1:16 ` Linus Torvalds
2014-08-02 5:16 ` Christopher Li
2014-08-02 18:10 ` Linus Torvalds
2014-08-02 18:31 ` Derek M Jones
2014-08-02 18:40 ` Christopher Li
2014-08-02 19:53 ` Linus Torvalds
2014-08-02 20:09 ` Linus Torvalds
2014-08-06 9:15 ` Christopher Li
2014-08-01 2:41 ` Josh Triplett
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=20140731181006.GA13180@cloud \
--to=josh@joshtriplett.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.