[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANeU7Qks_yHKNbeGZ7MvxC2MEO4tzehLDL-DEpqZ2+13vQfJxQ@mail.gmail.com>
Date: Thu, 17 Nov 2016 17:39:11 +0800
From: Christopher Li <sparse@...isli.org>
To: Johannes Berg <johannes@...solutions.net>
Cc: Linux-Sparse <linux-sparse@...r.kernel.org>,
Arnd Bergmann <arnd@...db.de>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] implement constant-folding in __builtin_bswap*()
On Thu, Aug 11, 2016 at 6:39 PM, Johannes Berg
<johannes@...solutions.net> wrote:
> Since gcc does this, it's apparently valid to write
>
> switch (x) {
> case __builtin_bswap16(12):
> break;
> }
>
> but sparse will flag it as an error today.
>
> The constant folding used to be done in the kernel's htons() and
> friends, but due to gcc bugs that isn't done anymore since
> commit 7322dd755e7d ("byteswap: try to avoid __builtin_constant_p
> gcc bug").
>
> To get rid of the sparse errors on every such instance now, just
> add constant folding to __builtin_bswap*() in sparse.
Sorry for the really late review.
This looks good. I would like to apply it. Can you please add some
test case for the function prototype you introduced, just like the way
kernel use it?
Thanks
Chris
Powered by blists - more mailing lists