From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932701AbeALBkS (ORCPT + 1 other); Thu, 11 Jan 2018 20:40:18 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:38340 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932340AbeALBkR (ORCPT ); Thu, 11 Jan 2018 20:40:17 -0500 Date: Thu, 11 Jan 2018 17:40:15 -0800 From: Andrew Morton To: Joe Perches Cc: LKML , Greg KH Subject: Re: checkpatch: exclude drivers/staging from if with unnecessary parentheses test Message-Id: <20180111174015.3de3dcd03730cba164d0a97b@linux-foundation.org> In-Reply-To: <1515719873.9619.179.camel@perches.com> References: <1515704034.9619.165.camel@perches.com> <20180111150319.86ca6ee1c16b85e4c0e034a0@linux-foundation.org> <1515719873.9619.179.camel@perches.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Thu, 11 Jan 2018 17:17:53 -0800 Joe Perches wrote: > On Thu, 2018-01-11 at 15:03 -0800, Andrew Morton wrote: > > On Thu, 11 Jan 2018 12:53:54 -0800 Joe Perches wrote: > > > > > Greg KH doesn't like this test so exclude the staging directory > > > from the implied --strict only test unless --strict is actually > > > used on the command-line. > > > > > > > "doesn't like" is rather vague. What is the objection, specifically? > > Unnecessary parentheses sometimes make code > easier to read for those that don't know C > very well. i.e.: Greg and maybe others too. > > > Also, an example of code which has an "if with unnecessary parentheses" > > would help others understand the decision. > > if ((foo == bar) && > (baz != qux)) > > where the parentheses around the comparisons are > generically unnecessary as the && is a much higher > precedence than the comparisons. OK, agree. I too don't like to be doubtfully staring at something trying to remember the precedence rules. Within limits. There are of course cases where the parenthesization is silly (who doesn't know that * is higher than +?). But such silliness-detection is probably beyond checkpatch ;)