Re: sparse on Ubuntu 18.04

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

 



On Fri, May 18, 2018 at 03:23:32PM -0700, 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.
> 
> 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, I agree.
 
> 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?

I'm all for it.
Sparse doesn't yet handle -Wpedantic but it should be very easy to add.

-- Luc
--
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