From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B3CFC64E8A for ; Sun, 29 Nov 2020 18:16:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E369A20731 for ; Sun, 29 Nov 2020 18:16:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=hansenpartnership.com header.i=@hansenpartnership.com header.b="N6BgciTr"; dkim=pass (1024-bit key) header.d=hansenpartnership.com header.i=@hansenpartnership.com header.b="N6BgciTr" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728288AbgK2SQT (ORCPT ); Sun, 29 Nov 2020 13:16:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725468AbgK2SQR (ORCPT ); Sun, 29 Nov 2020 13:16:17 -0500 Received: from bedivere.hansenpartnership.com (bedivere.hansenpartnership.com [IPv6:2607:fcd0:100:8a00::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27D39C0613D2; Sun, 29 Nov 2020 10:15:36 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by bedivere.hansenpartnership.com (Postfix) with ESMTP id E8E62128098B; Sun, 29 Nov 2020 10:15:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hansenpartnership.com; s=20151216; t=1606673733; bh=KQfMF1A2OIPPAOwzmMPIGnkshCqrekjHxY7nCeJhFhQ=; h=Message-ID:Subject:From:To:Date:In-Reply-To:References:From; b=N6BgciTrlrM/EIZ+6zPwCOWWFEj3JSAEbIY3sehF2hTbXB2/aBJhqnMZkYI23mTjv VpZKx8cegIzteHmno+VPPspd4uDPnpEPODiNq8L9uOzDhMn2zOLqAy0BWuACHottKY PzqsDFGhye6i05zSr5ujFPw8kTQfrhDbSMLwBubc= Received: from bedivere.hansenpartnership.com ([127.0.0.1]) by localhost (bedivere.hansenpartnership.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8Valpx4ImvwB; Sun, 29 Nov 2020 10:15:33 -0800 (PST) Received: from jarvis.int.hansenpartnership.com (unknown [IPv6:2601:600:8280:66d1::527]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bedivere.hansenpartnership.com (Postfix) with ESMTPSA id 60BC7128098A; Sun, 29 Nov 2020 10:15:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hansenpartnership.com; s=20151216; t=1606673733; bh=KQfMF1A2OIPPAOwzmMPIGnkshCqrekjHxY7nCeJhFhQ=; h=Message-ID:Subject:From:To:Date:In-Reply-To:References:From; b=N6BgciTrlrM/EIZ+6zPwCOWWFEj3JSAEbIY3sehF2hTbXB2/aBJhqnMZkYI23mTjv VpZKx8cegIzteHmno+VPPspd4uDPnpEPODiNq8L9uOzDhMn2zOLqAy0BWuACHottKY PzqsDFGhye6i05zSr5ujFPw8kTQfrhDbSMLwBubc= Message-ID: Subject: Re: [PATCH] locks: remove trailing semicolon in macro definition From: James Bottomley To: Randy Dunlap , Tom Rix , Matthew Wilcox Cc: jlayton@kernel.org, bfields@fieldses.org, viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Sun, 29 Nov 2020 10:15:32 -0800 In-Reply-To: References: <20201127190707.2844580-1-trix@redhat.com> <20201127195323.GZ4327@casper.infradead.org> <8e7c0d56-64f3-d0b6-c1cf-9f285c59f169@redhat.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.4 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2020-11-29 at 09:52 -0800, Randy Dunlap wrote: > On 11/29/20 9:47 AM, Tom Rix wrote: > > On 11/27/20 11:53 AM, Matthew Wilcox wrote: > > > On Fri, Nov 27, 2020 at 11:07:07AM -0800, trix@redhat.com wrote: > > > > +++ b/fs/fcntl.c > > > > @@ -526,7 +526,7 @@ SYSCALL_DEFINE3(fcntl64, unsigned int, fd, > > > > unsigned int, cmd, > > > > (dst)->l_whence = (src)->l_whence; \ > > > > (dst)->l_start = (src)->l_start; \ > > > > (dst)->l_len = (src)->l_len; \ > > > > - (dst)->l_pid = (src)->l_pid; > > > > + (dst)->l_pid = (src)->l_pid > > > This should be wrapped in a do { } while (0). > > > > > > Look, this warning is clearly great at finding smelly code, but > > > the > > > fixes being generated to shut up the warning are low quality. > > > > > Multiline macros not following the do {} while (0) pattern are > > likely a larger problem. > > > > I'll take a look. > > Could it become a static inline function instead? > or that might expand its scope too much? I think nowadays we should always use static inlines for argument checking unless we're capturing debug information like __FILE__ or __LINE__ or something that a static inline can't. Even in the latter case the pattern should probably be single line #define that captures the information and passes it to a static inline. There was a time when we had problems with compiler expansion of static inlines, so we shouldn't go back and churn the code base to change it because there's thousands of these and possibly some old compiler used for an obscure architecture that still needs the define. James