Re: sparse on Ubuntu 18.04

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 18/05/18 23:23, Linus Torvalds wrote:
> On Fri, May 18, 2018 at 2:56 PM Ramsay Jones <ramsay@xxxxxxxxxxxxxxxxxxxx>
> wrote:
> 
>>    /usr/include/x86_64-linux-gnu/sys/sysmacros.h:79:1: warning: constant
> 0xfffff00000000000u is so big it is unsigned long
>>    /usr/include/x86_64-linux-gnu/sys/sysmacros.h:80:1: warning: constant
> 0x00000ffffff00000u is so big it is unsigned long
> 
> I do wonder if we should just remove this warning, at least for files that
> have been looked up using the system include directories.

I briefly thought about only warning if -Wsystem-headers was given.
Hmm, maybe I should look at that some more (I suspected that it would
open a can of worms ... :-D ).

> This warning keeps on happening, and nobody ever seems to much care. And
> that's because it often warns for code that is "obviously correct" (like
> your example), which is a mark of a bad warning.

yes, good point.

> It's not like the implicit type changes ever drops bits, or even does
> anything truly surprising.
> 
> The "do_warn & 2" case where C99 and C90 compilers actually have different
> types, now _that_ is worth warning for.
> 
> And we do warn for actual lost bits in implicit casts, so if people use a
> constant that is too large in a context where it then loses bits, we give
> that other warning
> 
>    warning: cast truncates bits from constant value (abc becomes xyz)
> 
> so the value of the odd constant sizing warning is debatable. Maybe we
> could move it to pedantic warnings?

OK, I'll take a look. Thanks!

ATB,
Ramsay Jones


--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux