From: Tony Camuso <tcamuso@redhat.com>
To: Christopher Li <sparse@chrisli.org>
Cc: Josh Triplett <josh@joshtriplett.org>,
Linux-Sparse <linux-sparse@vger.kernel.org>
Subject: Re: [PATCH 3/3] Add NOWARN and NOERR compile conditions
Date: Sun, 2 Aug 2015 19:16:54 -0400 [thread overview]
Message-ID: <55BEA4E6.50702@redhat.com> (raw)
In-Reply-To: <CANeU7QkK5N8Jskcq9J1ODCeZEQYSAJTW-6PdKg1uuZeNXPYKTA@mail.gmail.com>
On 08/01/2015 02:45 PM, Christopher Li wrote:
> On Sat, Aug 1, 2015 at 4:09 AM, Tony Camuso <tcamuso@redhat.com> wrote:
>>
>> I've since submitted a runtime patch (3/3 V3) with a switch as a
>> response to this patch, but it basically does the same thing here.
>>
>> Consider the case where the source contains something like this...
>>
>> struct foo {
>> union {
>> int number;
>> int *pointer;
>> };
>> };
>>
>> There being no ident for the union within the struct, we get the warning,
>> "missing identifier in declaration" etc.
>>
>
> I can't reproduce the warning with the chrisl repo master branch.
>
> That being said, if there is indeed a bug in sparse, it should be a
> separate patch. It changes the parsing behavior.
>
> Thanks
>
> Chris
>
This doubt this is a sparse bug. It is an most likely caused by some RHEL
specific macros with encapsulated anonymous unions devised to protect the
Kernel Application Binary Interface while backporting upstream changes
from point release to point release. I can try to convince the KABI macro
maintainers to make their macros sparse-compliant, but I'm hoping you agree
that it might not be a bad idea to provide an option to disable the sparse
error reporting in the meantime.
If you're interested in pursuing this further, these are the errors I'm
seeing, followed by the source that generates them.
/work/linux/fs/bio.i:9137:130: error: Expected ) in function declarator
/work/linux/fs/bio.i:9137:130: error: got (
builtin:0:0: error: expected ; at end of declaration
builtin:0:0: error: expected ; at end of declaration
builtin:0:0: error: expected ; at end of declaration
/work/linux/fs/bio.i:9137:172: error: Expected ; at the end of type declaration
/work/linux/fs/bio.i:9137:172: error: got }
/work/linux/fs/bio.i:9137:209: error: Expected ; at the end of type declaration
/work/linux/fs/bio.i:9137:209: error: got }
/work/linux/fs/bio.i:9137:266: error: Expected ) in function declarator
/work/linux/fs/bio.i:9137:266: error: got (
/work/linux/fs/bio.i:9137:308: error: Expected ; at the end of type declaration
/work/linux/fs/bio.i:9137:308: error: got }
/work/linux/fs/bio.i:9137:350: error: Expected ; at the end of type declaration
/work/linux/fs/bio.i:9137:350: error: got }
/work/linux/fs/bio.i:9137:382: error: Expected ; at the end of type declaration
/work/linux/fs/bio.i:9137:382: error: got }
/work/linux/fs/bio.i:9137:385: error: Expected ; at the end of type declaration
/work/linux/fs/bio.i:9137:385: error: got }
/work/linux/fs/bio.i:9139:1: error: Expected ; at the end of type declaration
/work/linux/fs/bio.i:9139:1: error: got }
The anonymous unions giving us those error messages are encapsulated
in a RHEL-specific macro.
# define _RH_KABI_REPLACE(_orig, _new) \
union { \
_new; \
struct { \
_orig; \
} __UNIQUE_ID(rh_kabi_hide); \
__RH_KABI_CHECK_SIZE_ALIGN(_orig, _new); \
}
Here's an example of the macro invocation.
RH_KABI_REPLACE(void *spin_mlock, /* Spinner MCS lock */
struct optimistic_spin_queue *osq) /* Spinner MCS lock */
The preprocessor expands it as follows.
union { struct optimistic_spin_queue *osq; struct { void *spin_mlock; } __UNIQUE_ID_rh_kabi_hide0; union { _Static_assert(sizeof(struct{struct optimistic_spin_queue *osq;}) <= sizeof(struct{void * spin_mlock;}), "kabi sizeof test panic"); _Static_assert(__alignof__(struct{struct optimistic_spin_queue *osq;}) <= __alignof__(struct{void *spin_mlock;}), "kabi alignof test panic"); }; };
next prev parent reply other threads:[~2015-08-02 23:16 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-30 0:26 [PATCH 0/3] Minor enhancements and fixes Tony Camuso
2015-07-30 0:26 ` [PATCH 1/3] .gitignore: add cscope and Qt project files Tony Camuso
2015-08-03 17:41 ` [PATCH 1/3 v2] " Tony Camuso
2015-08-08 3:58 ` Christopher Li
2015-08-10 11:18 ` Tony Camuso
2015-08-10 12:33 ` [PATCH 1/3 v3] " Tony Camuso
2015-07-30 0:26 ` [PATCH 2/3] c2xml.c, parse.c: gcc 5+ stricter case statement parsing Tony Camuso
2015-08-04 12:06 ` [PATCH 2/3 v2] Handle all enum members in case statements Tony Camuso
2015-08-04 23:31 ` Christopher Li
2015-08-04 23:52 ` Tony Camuso
[not found] ` <CANeU7Q=QAtRqDP36k8uOd9_XgzqjJ0du5SO2WpMEcjp8+mg3CQ@mail.gmail.com>
2015-08-10 11:16 ` Tony Camuso
2015-08-10 12:35 ` [PATCH 2/3 v3] Add default case to switches on enum variables Tony Camuso
2015-07-30 0:26 ` [PATCH 3/3] Add NOWARN and NOERR compile conditions Tony Camuso
2015-07-30 2:55 ` Josh Triplett
2015-07-30 11:45 ` Tony Camuso
2015-07-31 23:46 ` Christopher Li
2015-08-01 11:09 ` Tony Camuso
2015-08-01 17:52 ` Josh Triplett
2015-08-01 18:45 ` Christopher Li
2015-08-02 13:42 ` Tony Camuso
2015-08-02 23:16 ` Tony Camuso [this message]
2015-08-02 23:22 ` Tony Camuso
2015-08-03 11:23 ` Nicolai Stange
2015-08-03 11:47 ` Tony Camuso
2015-07-31 17:07 ` Tony Camuso
2015-07-31 17:12 ` [PATCH 3/3 V2] lib.c: add Wall_off switch Tony Camuso
2015-07-31 18:01 ` Tony Camuso
2015-07-31 19:27 ` [PATCH 3/3 V3] Add Wall_off switch to disable errors and warnings Tony Camuso
2015-08-01 12:59 ` Sam Ravnborg
2015-08-01 13:52 ` Tony Camuso
2015-08-03 16:35 ` [PATCH 3/3 v4] " Tony Camuso
2016-01-05 1:19 ` Luc Van Oostenryck
2016-01-13 14:39 ` Tony Camuso
2015-08-03 18:10 ` [PATCH 0/3] Minor enhancements and fixes Tony Camuso
2015-12-02 18:52 ` Tony Camuso
2016-02-02 18:54 ` Christopher Li
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=55BEA4E6.50702@redhat.com \
--to=tcamuso@redhat.com \
--cc=josh@joshtriplett.org \
--cc=linux-sparse@vger.kernel.org \
--cc=sparse@chrisli.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).