Re: linux-next: disabling -Wstringop-truncation

From: Miguel Ojeda
Date: Thu Sep 20 2018 - 12:28:45 EST


Hi Stephen, Andi, (Linus),

On Fri, Aug 31, 2018 at 3:17 AM, Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Thu, Aug 30, 2018 at 3:07 PM Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> wrote:
>>
>> I am now mainly using gcc v8.2 for my builds and -Wstringop-truncation
>> causes so many warnings that I am sure to miss others, so I have
>> applied the below to my fixes tree until the noise reduces.
>
> Applied.
>
> If people want the warning with W=xyz, then this is still the correct
> patch, and we should add a line to re-enable it in
> scripts/Makefile.extrawarn.

For reference, I am sending the v5 of the Compiler Attributes series
with the __nonstring patches appended on top, and I am adding the
warning back as well, on W=1.

I think W=1 is better: there are not that many warnings compared to
those in W=2. AFAIK, it is relatively easy to achieve a clean W=1 (and
most code should at least try be W=1 clean, no?). Also, note that now
people can use __nonstring to suppress that warning (if applicable);
and that using properly __nonstring can detect even more problems
(i.e. adding __nonstring may trigger additional warnings, e.g.
-Wstringop-overflow); so I think we should encourage the use of
__nonstring.

Cheers,
Miguel