[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VfmSNs4jHJjybGHisHSGiwcYv8msBjhshp7bAQNDW9Oag@mail.gmail.com>
Date: Wed, 28 Feb 2018 17:50:03 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Segher Boessenkool <segher@...nel.crashing.org>
Cc: Mathieu Malaterre <malat@...ian.org>,
"open list:LINUX FOR POWERPC PA SEMI PWRFICIENT"
<linuxppc-dev@...ts.ozlabs.org>, Paul Mackerras <paulus@...ba.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Jiri Slaby <jslaby@...e.com>
Subject: Re: [PATCH 01/21] powerpc: Remove warning on array size when empty
On Tue, Feb 27, 2018 at 10:42 PM, Segher Boessenkool
<segher@...nel.crashing.org> wrote:
> On Tue, Feb 27, 2018 at 05:52:06PM +0200, Andy Shevchenko wrote:
>> On Tue, Feb 27, 2018 at 9:44 AM, Mathieu Malaterre <malat@...ian.org> wrote:
>> > On Tue, Feb 27, 2018 at 8:33 AM, Christophe LEROY
>> > <christophe.leroy@....fr> wrote:
>>
>> >>>>> Much simpler is just add
>> >>>>>
>> >>>>> if (ARRAY_SIZE() == 0)
>> >>>>> return;
>>
>> >> Or add in front:
>> >> if (!ARRAY_SIZE(feature_properties))
>> >> return;
>> >
>> > (not tested) I believe the compiler still go over the for() loop and
>> > will complain about the original unsigned comparison.
>>
>> Did you run tests? Did you look into object file?
>>
>> In kernel we much rely on the compiling away the code which is
>> deterministically not in use.
>> Here I'm pretty sure it will compile away entire function.
>
> It does, but it also still warns (this warning is done very early in the
> compiler pipeline).
Oh, I see.
Then the while () approach looks to me the best here.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists