Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1197186lqz; Sun, 31 Mar 2024 19:45:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXwe45iFHrFfi8aJ+SD4rG70WIyrDkSBndaV+6+8klaktYUCAbksfAefiTyHTyhzLn+zvUb0AVjnv0V6ZrfTqB4/zKTj3STjqH5jIPl4w== X-Google-Smtp-Source: AGHT+IH+LE0OZPNKYwQOp5ib5cj1QV83AJN0XfxSH3cdgCQPdh4xU4Vhfo3LlZZ2eTCj9ycqau1C X-Received: by 2002:a17:902:e5d0:b0:1e2:23d2:a855 with SMTP id u16-20020a170902e5d000b001e223d2a855mr9420094plf.28.1711939542152; Sun, 31 Mar 2024 19:45:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711939542; cv=pass; d=google.com; s=arc-20160816; b=d9gIjY7OxL7rvpLHxfwvDW4JZkwaxvXYFDIV3CtVtZUBv2JEzcRFx0hl/NrLvd7m5K DI/vfa13xw4kmV3pmeqEfvmcD+3ImW2GaLjzTcTM/0rgKxbwHpbEm9NHZbwAjvw/cYEF NfOsMwblcrZ3e0nqr5pr41ZxwWA7PS78UTk4wcp3VDjCp8gvvnY2VNbnV9aflafsRrW1 J4heHhie3lTy85NOgR+qwT/BVNzotNjuqWAGn6wWEDCX4QHxh4QqP+c3/F0cqhUuENv3 K+YJQnsZbFkYkCK0xFmIZUcaJFyax6MuianuOElkb3xvbWrJjFvpIWnbEHdbhPB33bNk +SvQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id; bh=TbH7c80dtgWyl9AfgmBVhiTICbo3S+8wHgpoesYOPf0=; fh=qguF/31GrrvdYpHXBrubwPg0rFiVL/ghWmJYkS2hemI=; b=JHMD9VHV9WFYFUuk3WErTHUAkJifFplB8cis3o9eIRvGCPLUB0Sr7I5xqMk81Z5XUk Ksh7LIPFc7K+SCwDKXG7MaE/yGjSQiyheLT8Z7b8GaKdI9adNJB1L1tDdh4jssf1PGoE GRKsJuu7IY1gzQcM1c4LGKY9HfIkUdruXFXgJsuWvm9PrU+mE0Fif17z/8+FeVAYCjYc LP98bCRtu808K18dQRYY2xNUY2gDYGuvQhJwyL+2qWakRyE0ZgPNZooq6Tx4ZokvOd+k kjPBV+DnBGQSd5U7sUqDm4SLvljWf69J670fNSmhzkGT4xX0+XUlz4tJYnmCxZFvTfMu /Cpg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=perches.com); spf=pass (google.com: domain of linux-kernel+bounces-126416-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126416-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id z16-20020a170903019000b001e003f31d59si8740805plg.137.2024.03.31.19.45.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Mar 2024 19:45:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-126416-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=perches.com); spf=pass (google.com: domain of linux-kernel+bounces-126416-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126416-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id C651FB2113A for ; Mon, 1 Apr 2024 02:45:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0326A610E; Mon, 1 Apr 2024 02:45:24 +0000 (UTC) Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BEA144A3E; Mon, 1 Apr 2024 02:45:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.40.44.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711939523; cv=none; b=RhzSso8I/1USRUDdD/VPOurOjXvLJ5TsvNH11KJZiCa0IBDXWLAc9bbbokuVUJge3AhB4+vxxzixG13cM8uQaDYca7qefpbNRtRIpv+5KtCEB+SZRQ9bN8QE5BI2gosBn4IAgRAatM9b3jLsfGEkWjPViEMOOXOVzFRJNNQQ6b4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711939523; c=relaxed/simple; bh=/ikhAY81eL2sCha6HmZfwOSjv2FnyUPw0qvgAVX+Pm0=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=kWRpAGgmT2ZCJNPpqylEfGa7J5FsSyTwY1b/X3ZraR4Qoi1mKhiW5rjn4l3BAISdbuzTtIRCjXMktWWxK5L+cbIVJk9KXDfEM7Y1ZQDgq9eZK9I0wEn4oleKiD9lGo1QQNW2410RiW8nBmUzhcFXAmgJQLyBqoFA3pLSeawNTgc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com; spf=pass smtp.mailfrom=perches.com; arc=none smtp.client-ip=216.40.44.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=perches.com Received: from omf14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id E5F9B140163; Mon, 1 Apr 2024 02:37:16 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf14.hostedemail.com (Postfix) with ESMTPA id 94F752F; Mon, 1 Apr 2024 02:37:10 +0000 (UTC) Message-ID: Subject: Re: [PATCH v5 2/2] scripts: checkpatch: check unused parameters for function-like macro From: Joe Perches To: Barry Song <21cnbao@gmail.com>, akpm@linux-foundation.org, linux-doc@vger.kernel.org, workflows@vger.kernel.org Cc: apw@canonical.com, broonie@kernel.org, chenhuacai@loongson.cn, chris@zankel.net, corbet@lwn.net, dwaipayanray1@gmail.com, herbert@gondor.apana.org.au, linux-kernel@vger.kernel.org, linux@roeck-us.net, lukas.bulwahn@gmail.com, mac.xxn@outlook.com, sfr@canb.auug.org.au, v-songbaohua@oppo.com, Max Filippov , Jeff Johnson , Charlemagne Lasse Date: Sun, 31 Mar 2024 19:37:09 -0700 In-Reply-To: <20240401012120.6052-3-21cnbao@gmail.com> References: <20240401012120.6052-1-21cnbao@gmail.com> <20240401012120.6052-3-21cnbao@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Rspamd-Queue-Id: 94F752F X-Rspamd-Server: rspamout08 X-Stat-Signature: a64u7rec3zbcz9m6awd8n83w4n8owb8p X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX18vTDvEamRn37xuX0ppkjF8TUYGi2CltWY= X-HE-Tag: 1711939030-101202 X-HE-Meta: U2FsdGVkX1+Dx54Uuqrd53Q4Vep/KFkwhvXqJk6K+2fTwbRYgQygoOfSJsYBJDw84ZBamvcQYhupnfrLn9ldNQLAGJrWEj60xTLfSMsyleKhi+/p0qWgdGoJZqMSe3Zz76le2WPoWvML+QMTcLEbO6OKVuncThXxfrNnF7TxLynxHvalOcCJkIbvmpMSjdGtIcAvARlWuSxHJHXBIT5Kz8ZnBmmRdi2hFRwBL4KiWABcewafY6N2K4ALoAvk4roy7Kc+RUcymqg513RXQzkbUxY4qOKha6WrqQgUXIeJhuU7UsF7BacG7m/oo5yCsHL3vqxp7tjU6T6r7x0Te8gtdCUullfxBDA/ On Mon, 2024-04-01 at 14:21 +1300, Barry Song wrote: > From: Xining Xu >=20 > If function-like macros do not utilize a parameter, it might result in a > build warning. In our coding style guidelines, we advocate for utilizing > static inline functions to replace such macros. This patch verifies > compliance with the new rule. >=20 > For a macro such as the one below, >=20 > #define test(a) do { } while (0) >=20 > The test result is as follows. >=20 > ERROR: Parameter 'a' is not used in function-like macro, please use stat= ic > inline instead > #21: FILE: mm/init-mm.c:20: > +#define test(a) do { } while (0) This is no longer true. Please update the ERROR->WARN and message as below Ideally, this would have an update to Documentation/dev-tools/checkpatch.rst to describe the new --verbose message type > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl [] > @@ -6040,6 +6040,12 @@ sub process { > CHK("MACRO_ARG_PRECEDENCE", > "Macro argument '$arg' may be better as '($arg)' to avoid prece= dence issues\n" . "$herectx"); > } > + > +# check if this is an unused argument > + if ($define_stmt !~ /\b$arg\b/) { > + WARN("MACRO_ARG_UNUSED", > + "Argument '$arg' is not used in function-like macro\n" . "$herectx= "); > + }