Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp5571733rdb; Sun, 17 Sep 2023 02:49:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFTBbHEyM0wH9gTFPJxTbvL9RY2E93t0a+GZ53qpEYn2ByvGqsbJ7Kzy/61FKGGzm5FQ+m3 X-Received: by 2002:a05:620a:99c:b0:76f:1742:2f6c with SMTP id x28-20020a05620a099c00b0076f17422f6cmr6228151qkx.66.1694944195770; Sun, 17 Sep 2023 02:49:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694944195; cv=none; d=google.com; s=arc-20160816; b=g7lSz6MMjN74CFAAJrlCmGsr3VkyITcHMMNKCgkEw/Ze3mY/fpWNM3n5/lruS8eEp9 +3xL6mEBUHKxTa9adnekEtQBMhH/pvC09g6QBoTZ3+nB7HTnFuQCJmXOABywzWFlPbz5 qkkuJyIGRAfIP+i5HXESu4tDv8HXaEWav2zkVSgCKqXNRAgZN2H1LAXpTvDsXEwY7jBQ i4fVUVO3a6sNeQp9mjtOn13QTtGyFgFhZU2FihpSorMVPdGFnk1OoI6w13kyE2bY9UVa FsTyXCzfxHUN3LUeWUnN+9s0gmaLBtIUE/2pZhWzIP5wHiYQjsa4Kw9relbPEkYpqC/D uSoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=0DdIoxuzJbb1QwQrblhQ/YJsW+UwdyWkl+VBXXqKnpk=; fh=q3eJ70+nPBBOurH5DI6uivZtkSdfT1YhlPrRDAlF5bE=; b=aWGnkulblvaJMfKnvNroy4AZTXnwDcxZk4645Oz4boP7NPwmFq2L/OPn0hdnfRrVb5 fdXalZXfj0RIaoNFGsXEVaLrYlt1NjwWPPlhxJtOTHz9HhBrQ2WRrshOvffMxIxVYLuv +Var616DTD06/WfiwuZEX6fOszx/Ap3qnWVgdijH9iaXsZzIwXUxOpvFJAeY8haU/MWM Mz2AUaeqsvzhNOX3Jiz7jdtAXjZAk65Ljhv1ao9Y+vo8GUCrgKbdYwgvZuOZ7ijr/Lpr vzEtDEtiX1FFLUj7xsG2Yx5ULZvzMLimv1Ghlz8EL3YH8QuzMlEw3SwZP0lNBFQ7yGgO Y1Vw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id s10-20020a63e80a000000b0057754ded064si6060958pgh.555.2023.09.17.02.49.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Sep 2023 02:49:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 7FD1C802F7CA; Sun, 17 Sep 2023 02:49:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235112AbjIQJtW (ORCPT + 99 others); Sun, 17 Sep 2023 05:49:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236387AbjIQJtA (ORCPT ); Sun, 17 Sep 2023 05:49:00 -0400 Received: from 1wt.eu (ded1.1wt.eu [163.172.96.212]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7E6E7193; Sun, 17 Sep 2023 02:48:49 -0700 (PDT) Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 38H9mRSk011095; Sun, 17 Sep 2023 11:48:27 +0200 Date: Sun, 17 Sep 2023 11:48:27 +0200 From: Willy Tarreau To: Thomas =?iso-8859-1?Q?Wei=DFschuh?= 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: <20230917094827.GA11081@1wt.eu> References: <20230914-nolibc-syscall-nr-v1-0-e50df410da11@weissschuh.net> <20230914-nolibc-syscall-nr-v1-2-e50df410da11@weissschuh.net> <20230917025851.GE9646@1wt.eu> <2bd688b7-5f1b-44ca-a41b-6e90dc3e8557@t-8ch.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2bd688b7-5f1b-44ca-a41b-6e90dc3e8557@t-8ch.de> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Sun, 17 Sep 2023 02:49:53 -0700 (PDT) On Sun, Sep 17, 2023 at 07:49:57AM +0200, Thomas Wei?schuh wrote: > 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. OK then let's handle it. > > @@ -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. Of course, I was just trying to illustrate. I'm never good at giving names. > 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 like it, I didn't think about varargs, it's an excellent idea! Let's just do simpler, start with a first arg "syscall_num" that we may later reuse for debugging, and just mark this one unused: static inline int __nolibc_enosys(int syscall_num, ...) { (void)syscall_num; return -ENOSYS; } Willy