Re: [PATCH 01/23] contrib/coccinnelle: add equals-null.cocci

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

 



Philip Oakley <philipoakley@iee.email> writes:

> On 30/04/2022 05:13, Elia Pinto wrote:
>> Add a coccinelle semantic patch necessary to reinforce the git coding style
>> guideline:
>>
>> "Do not explicitly compute an integral value with constant 0 or '\ 0', or a
>
> s/compute/compare/
>> pointer value with constant NULL."
>
> If this gets re-rolled, perhaps include a simple example for those who
> don't immediately understand that quoted sentence. It will also help
> decode the coccinelle script
>
> so:     `if (ptr == NULL)` becomes `if (!ptr)`  etc.

That is certainly a good suggestion, but I am wondering if we want
to also emphasize another more generally applicable rule that
appears much earlier in the guideline document:

 - Fixing style violations while working on a real change as a
   preparatory clean-up step is good, but otherwise avoid useless code
   churn for the sake of conforming to the style.

   "Once it _is_ in the tree, it's not really worth the patch noise to
   go and fix it up."
   Cf. http://lkml.iu.edu/hypermail/linux/kernel/1001.3/01069.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux