From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755368AbcITRHh (ORCPT ); Tue, 20 Sep 2016 13:07:37 -0400 Received: from smtprelay0075.hostedemail.com ([216.40.44.75]:59784 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753964AbcITRHg (ORCPT ); Tue, 20 Sep 2016 13:07:36 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::,RULES_HIT:41:355:379:541:599:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1540:1593:1594:1711:1730:1747:1777:1792:2110:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3870:3871:3872:3874:4321:4362:5007:9008:10004:10400:10848:11026:11232:11473:11658:11914:12295:12438:12679:12740:13069:13181:13229:13311:13357:13439:13894:14659:14721:21080:21324:21433:21451:30012:30034:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:3,LUA_SUMMARY:none X-HE-Tag: crowd40_24fd33ef55a29 X-Filterd-Recvd-Size: 1945 Message-ID: <1474391253.1954.39.camel@perches.com> Subject: Re: Possible code defects: macros and precedence From: Joe Perches To: Julia Lawall Cc: Dan Carpenter , LKML , Andrew Morton Date: Tue, 20 Sep 2016 10:07:33 -0700 In-Reply-To: References: <1472927739.5018.13.camel@perches.com> <1473001581.5018.37.camel@perches.com> <1474147658.1954.1.camel@perches.com> <1474191110.1954.16.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.21.91-1ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2016-09-20 at 15:14 +0200, Julia Lawall wrote: > The semantic patch below finds a binary operator in a macro and a binary > operator in the use of the macro, and checks if the priority of the > operator in the macro is higher (lower number) than the priority of the > operator in the use.  If this is the case, it adds parentheses in the use, > which is not what one wants, but serves to show where the problem is Thanks, this works on the trivial example I suggested without an #include I've tried it on trivial files with --recursive-includes and it seems to work there too. I'll investigate some more convoluted uses later. btw: There are ~15K checkpatch MACRO_ARG_PRECEDENCE messages in the -next kernel tree.  That's probably too many for a theoretical and likely not an actual problem. cheers, Joe