Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp5477469rwb; Tue, 1 Aug 2023 03:20:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlHDsPvzrrND3Y0tdeQ9oZRT63Yo/5gKux17EbvYAhIK/SM4tFqD10T9UuYe6cHsj3/+HK8d X-Received: by 2002:a05:6870:f589:b0:19f:2257:6865 with SMTP id eh9-20020a056870f58900b0019f22576865mr13141574oab.31.1690885210128; Tue, 01 Aug 2023 03:20:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690885210; cv=none; d=google.com; s=arc-20160816; b=iT1BypdrVIPsT5/I2lKkrl9a+5E2f/7GY8joWx0pQjStB2B193lgy8VIyt/R5JR79Y M8FoMGoTfOU+7fbwkQQMGVPD8yFYuZSVAc6tToFkiwrdYZke018CasDMyjf63QS9L/U/ MA/2tDt2S5m7g9VVJ1MlwXg9aUe01ake8qTjzjVM12kJNtcaIn8MlCB32DH8cOlrq875 pV4gctkDAD/XlVfwUjBp12o6lyRNLXlGBsO1HKgk/jH1K6Q1mfBNcwMlcALHaneq0Tjt b1bIhOmL7Gfs1PVKOGdqJ6bXJFZHZsAP2YZ9VH0tZddCJUpvNC6R2sau5w5NfR9UK9Vg Tv9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=1RMTna/vbgeGLgA/8Ob3HMOvunuid1tST3cWSESdrBw=; fh=Q4MvkSz8FYcHPE+pFaGSR8c4aLVk8U0IU8szbKVfuTg=; b=JLKS/gqyFV5dwnFe6PluMU7mUNslV9A0ym6ztKAD6dfRBm+tUh0BTz0nQpGVlouAn1 dxJdvyepRUJMTGIJJuyqRcYZXBZ4iMIGxMXkN7UFrxGz2dimAVqtZsw+WW5ZifCVUlQd 7fPvFna58qTiVW8NTOHOxYhDrKRiLOQkMVs5pPtIpsUGA2Wb4iu/Bo0eem0MLJ9+Ktrb V3qXHtOnBs4CN6q8VsS56PjMKtXziRSTI0WOHsZP4k0lRBFk4Z2L+LJJQk4tKba5+kY6 5IdYbeHtULZTe+fYBNko8XLLVs9s7LuHCR1CAKVXuGMZOHNyyxgx+62lMmA+wcLj7aen af7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n127-20020a632785000000b0055e607f1e99si8764125pgn.882.2023.08.01.03.19.56; Tue, 01 Aug 2023 03:20:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232394AbjHAKPm (ORCPT + 99 others); Tue, 1 Aug 2023 06:15:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232369AbjHAKP0 (ORCPT ); Tue, 1 Aug 2023 06:15:26 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 020431B7; Tue, 1 Aug 2023 03:15:18 -0700 (PDT) X-QQ-mid: bizesmtp73t1690884913tdh90bq6 Received: from linux-lab-host.localdomain ( [116.30.131.233]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 01 Aug 2023 18:15:12 +0800 (CST) X-QQ-SSF: 01200000000000E0X000000A0000000 X-QQ-FEAT: zT6n3Y95oi30KINxb71iEGkZFmwk0xExAmr450WkSmrjQ6FUOfN0sBKn7EoOM /KDQ7euQ/5SsK+jc6T1XBJOI5kvvq6aKAm4LOI7P18kcXcdpMG4g4EwGP9phDr4bHMIgshD TH1JaXn1dYM926tHusvBNEJJ7iv7nOWFSTluKvsU7ec6LlV8mzLHmpIr8LHGHZrd6XLV6jH +lYfWHc1LLudXDjRxmyWUhQUFem0OVIUzLTmq2A7NitOG7GXOUwPIEWNBo7GDjwZCznLX1/ mnBzVYCGwsePZdKH5owmfoWRUYUTZXuGhorv1HpDe53EiRJPIkuhDTE28F36badC3zNN0K4 DogQfF0dGbXiQZ1mrGaAlvbXpbL7MCsdiXp45Hmxq+KSNqFuhOWwGFGwM/yCg== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 546874083959870445 From: Zhangjin Wu To: linux@weissschuh.net Cc: falcon@tinylab.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, shuah@kernel.org, tanyuan@tinylab.org, w@1wt.eu Subject: Re: [PATCH v2 07/10] selftests/nolibc: avoid unused arguments warnings Date: Tue, 1 Aug 2023 18:15:08 +0800 Message-Id: <20230801101508.75571-1-falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <6d67a8ed-8cb6-4ab7-8db0-68269981f8df@t-8ch.de> References: <6d67a8ed-8cb6-4ab7-8db0-68269981f8df@t-8ch.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Thomas > On 2023-08-01 10:07:28+0200, Willy Tarreau wrote: > > On Tue, Aug 01, 2023 at 07:30:14AM +0200, Thomas Weißschuh wrote: > > > This warnings will be enabled later so avoid triggering it. > > > > > > Signed-off-by: Thomas Weißschuh > > > --- > > > tools/testing/selftests/nolibc/nolibc-test.c | 3 ++- > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c > > > index 53a3773c7790..cb17cccd0bc7 100644 > > > --- a/tools/testing/selftests/nolibc/nolibc-test.c > > > +++ b/tools/testing/selftests/nolibc/nolibc-test.c > > > @@ -1089,7 +1089,8 @@ static int smash_stack(void) > > > return 1; > > > } > > > > > > -static int run_protection(int min, int max) > > > +static int run_protection(int __attribute__((unused)) min, > > > + int __attribute__((unused)) max) > > > > This one is used to silence -Wunused-parameter I guess. > > Yep. > > > It's one of > > the rare warnings that I find totally useless in field, because it's > > simply against the principle of using function pointers with different > > functions having the same interface but different implementations. As > > your code evolves you end up with unused on absolutely *all* of the > > arguments of *all* such functions, which makes them a real pain to add > > and tends to encourage poor practices such as excessive code reuse just > > by laziness or boredom. BTW it's one of those that are already disabled > > in the kernel and we could very well do the same here. > > It's indeed unfortunate. > > As long as we don't have too many of them I would prefer to keep the > explicit annotations. While they are ugly we then can still reap the > positive aspects of the warning. > > This is where -std=c89 bites us. With extensions (or C2X) we could also > just leave off the argument name to mark it as unused: > run_protection(int, int) what about further simply ignore the arguments like we did for main(void)? Thanks, Zhangjin