Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp5543067rdb; Sun, 17 Sep 2023 01:06:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH0/fvT6BJnrQK6JnbTPyuSCRK1v59rFtQmsBV8U9lGSXjC5yC+A/dwXhHjhK56dhaWrQ9I X-Received: by 2002:a17:902:c412:b0:1c3:4b24:d89d with SMTP id k18-20020a170902c41200b001c34b24d89dmr8442784plk.40.1694937982974; Sun, 17 Sep 2023 01:06:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694937982; cv=none; d=google.com; s=arc-20160816; b=LuaskJA92Kvzn657BPxjheBjRTtxSnB+rfJ6W7QVoJXVs7AqGHImem+F2hc5eLoCG1 pG7GqutuDgCAruZk4eKnctmxcaTsAzhj7LP3snD7Ae65aOq3HFbad/oaNA4QAHFNgCFH RZ4QN+vhYJf+NK/BP1O6tjiAcvldAIRHgyafRL1nJrztfp3If5ibIB7fxg0JZDd7cy3p xTqrvFv1bk1iI1uyH2ySDldZtn9drQp0losAV+uHAYyxUdQnl8lJopH0FS9tAXQ2Xgxp gkV0RIMyUGYZzF947kIShzkPWpGNyWUbqslOCTSHGAaD8bfnlEAP98xwgbu64emOn8gQ V3sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=UYp0YnBI5TlsvqI17cc5AfI3AL24xc6vAl6iOzyb0HE=; fh=PCAErqEBDnHzg8PgzBn2c1x9VjA3mzSS1RZCtvoIi6Y=; b=e/ONmSXqRTdWtB/zWRQ3suoFA8RLUNP9HEPdhKsxhiXDKLGAbBqnbbDMRU9RekU0R+ a4D+Ltb9mKxczSn4i+rRRTzQLVTuHpkKXG7YP7/qN5QQquMfkwRcVrGUGbont/rkSEsH 1MNLsrhqwTwW/sov7coIDc+hngb8RRw5UcShW5wKYrjubzGXCwYPK55tsBJMMt0y1lDw YHp6zxLKlehVOyIziA/yMdeR9GMehkMr0FQ1Vw1es+RrcVoLlA7wnMmhIdekZiZmj4ts 7YdC6dxr7ghJZB5ywsRaNwtX3iNRQwxWC5VA0QkTAMz1a7KjrhosAjt9dTwizpRdkEmf A8FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=bNhvK9CO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id i17-20020a170902e49100b001bdd1f48f91si6009930ple.564.2023.09.17.01.06.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Sep 2023 01:06:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=bNhvK9CO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 5DAD083ACEAE; Sat, 16 Sep 2023 23:11:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231837AbjIQFuj (ORCPT + 99 others); Sun, 17 Sep 2023 01:50:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230222AbjIQFuI (ORCPT ); Sun, 17 Sep 2023 01:50:08 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17BE310B; Sat, 16 Sep 2023 22:50:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1694929799; bh=I2ORHDPmzg8IMQkgZSGbyhmTUn7nAixQxkusYZXX9Ow=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bNhvK9COLyxFXqsSZoncbm4ouWx+Xn1gh6p+fU6V31arYi8oIbkEOyMxEv8YtTaM4 9JuXFJ7xrV8X8uhdb/ZrUvtuG054Xa4X5b66PsE+uDraTemleD4RBH9PezFqXpHXYh jgb+n3iwz/+Ck3NN2n1YjPHOM/2fLBWGlxMJLLTw= Date: Sun, 17 Sep 2023 07:49:57 +0200 From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Willy Tarreau Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Shuah Khan , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH 2/4] tools/nolibc: avoid unused parameter warnings for ENOSYS fallbacks Message-ID: <2bd688b7-5f1b-44ca-a41b-6e90dc3e8557@t-8ch.de> References: <20230914-nolibc-syscall-nr-v1-0-e50df410da11@weissschuh.net> <20230914-nolibc-syscall-nr-v1-2-e50df410da11@weissschuh.net> <20230917025851.GE9646@1wt.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230917025851.GE9646@1wt.eu> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sat, 16 Sep 2023 23:11:39 -0700 (PDT) On 2023-09-17 04:58:51+0200, Willy Tarreau wrote: > On Thu, Sep 14, 2023 at 06:01:18PM +0200, Thomas Weißschuh wrote: > > The ENOSYS fallback code does not use its functions parameters. > > This can lead to compiler warnings about unused parameters. > > > > Explicitly avoid these warnings. > > Just out of curiosity, did you find a valid case for enabling this > warning or were you trying various combinations ? I'm asking because > I've never seen it enabled anywhere given that it's probably the most > useless and unusable warning: as soon as you're dealing with function > pointers, you start to have multiple functions with a similar > prototype, some of which just don't need certain arguments, and the > only way to shut the warning is to significantly uglify the code. nolibc-test uses it currently and I also used it in some projects. > If really needed, I'm wondering if instead we shouldn't have an > "no_syscall*" set of macros, that would have the same signature > as my_syscall* to just consume all args in the same order and > return -ENOSYS. E.g, consider the following: > > @@ -934,6 +960,11 @@ int sys_select(int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeva > #endif > return my_syscall5(__NR__newselect, nfds, rfds, wfds, efds, timeout); > #else > + (void)nfds; > + (void)rfds; > + (void)wfds; > + (void)efds; > + (void)timeout; > return -ENOSYS; > #endif > > It would become: > > @@ -934,6 +960,11 @@ int sys_select(int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeva > #endif > return my_syscall5(__NR__newselect, nfds, rfds, wfds, efds, timeout); > #else > + return no_syscall5(nfds, rfds, wfds, efds, timeout); > - return -ENOSYS; > #endif > > What do you think ? The idea sounds good. But "no_syscall5" sounds a bit non-obvious to me. Maybe the macro-equivalent of this? static inline int __nolibc_enosys(...) { return -ENOSYS; } The only-vararg function unfortunately needs C23 so we can't use it. It's clear to the users that this is about ENOSYS and we don't need a bunch of new macros similar. I'll check if it is cleaner to implement a generic macro or a few numbered ones. Thomas