Re: Sparse crash when mixing int and enum in ternary operator

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

 



On Wednesday 10 of March 2010 21:27:21 Pavel Roskin wrote:
> That makes sense for certain kinds of software, where crash is too
> costly, but in case of sparse, I'd rather see it crash than ignore a
> condition that may indicate an error elsewhere (perhaps both in sparse
> and in the code it checks).
>
> I thing using assert() would be a better approach.  It's already used in
> sparse.
>
> I checked the whole kernel using assert in place of the NULL checks, and
> there have been no crashes.

I completely agree with that.  Let's give some time to sparse developers to 
respond.  If nobody objects, I'll change it to asserts.

> Maybe you could add a test case for the first patch?  What warnings does
> it remove?  What is "="?  Is it assignment or initialization or both?

Both of them.  Maybe worth to add a test-case for the initialization to make 
it more obvious...

> How about comparisons?

Definitely not.  That was the main goal of the 0001-Wenum-to-int patch.  It 
was really noisy since enum values are first implicitly casted to ints and 
then compared.  So there was no way to type-safely compare two enums without 
producing 6 lines of warnings.

> A better description would be nice.

Sure thing.  I didn't realize it was ambiguous.

Thank you for the review!

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