From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tomas Volf <~@wolfsden.cz> Newsgroups: gmane.lisp.guile.user Subject: Re: warning: possibly unused local top-level variable `%foo?-procedure' Date: Fri, 7 Jun 2024 00:52:09 +0200 Message-ID: References: <1674e944-f9c5-415c-ad0d-5c26efac8306@app.fastmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="BOZsqsgf3p5cQLm+" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40789"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-user@gnu.org To: Linus =?iso-8859-1?Q?Bj=F6rnstam?= Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Fri Jun 07 00:52:50 2024 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sFLyU-000ANN-AG for guile-user@m.gmane-mx.org; Fri, 07 Jun 2024 00:52:50 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sFLy0-0002BS-6g; Thu, 06 Jun 2024 18:52:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <~@wolfsden.cz>) id 1sFLxy-0002B8-Dl for guile-user@gnu.org; Thu, 06 Jun 2024 18:52:18 -0400 Original-Received: from wolfsden.cz ([37.205.8.62]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <~@wolfsden.cz>) id 1sFLxw-0005tL-5P for guile-user@gnu.org; Thu, 06 Jun 2024 18:52:18 -0400 Original-Received: by wolfsden.cz (Postfix, from userid 104) id 7914C29669B; Thu, 6 Jun 2024 22:52:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1717714331; bh=m6Unu7z5JEHLn4ruqyHX4NTz/q1Fiyc2E6twgr+kgYk=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=vBHXrbPklRP9kLXsY51MuIjHCHKPijFRW/yEWhUHSrlDZcT8biEAFyUPcMKjfe+Er 7zaLnFc3w2IakqjkecmAZpvmoNJspKjYuOv9KN4Bk4z/VeAieHZbKwYv+F1qu/3rsR oFUat3KyeZTmHbDZKqPphHJfuye0vgRLlne1KYxBARpuZuep6LP3VfH/qvFNv6ZXoP RDJ/vzOcqYsT+jFDu/P3yZalECUzb2j4pAb8BlGoDP9ne9lI6okkAls3X4IcP3ZyW1 BwI++Zf5lKcmiyEkvqeyDx3JTXBZMJNmjFwapWVe/2oP+yuD8TJhyYBQIks4ZzBXKp sm5wYHpX8TI6OpBLAxyBQtYjAt7Lyki3H6/arN6NhIX5NGvN2+HG1hMAujAksyE0+d gmleBrOqvWhSebJQNnl02At15uUBerdMdShyKjWHXfV0HdIkZowPArU3gN/dmkFwJj ilrH5MYfcRUQVEqjVdaWiGcDcwFevR+IYFEMrjlN4eoqfDVKnRxTFYNNKzlPkN2RR/ W7WVnI0eUeNVFogJ5SX1osQuJoZQo82wvOKfVXGTn3QrYEExzhswXSFTqg463TukrC VyjosM/K/zeTVRW515XKargp7EAC1VYkBkSneaitmqBobAJiIaZTnnCxHiAyQaCgdX YPKUtN2Gt+l/CniHSNcfWDuo= Original-Received: from localhost (unknown [81.17.16.69]) by wolfsden.cz (Postfix) with ESMTPSA id 79E42295D59; Thu, 6 Jun 2024 22:52:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1717714330; bh=m6Unu7z5JEHLn4ruqyHX4NTz/q1Fiyc2E6twgr+kgYk=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=AMOOk7psJ7j8fxv2O1PL4VMMuiyHGTRvQ4uCR6rX8+R8fA3J719hgqUWGtUgjgyvO JB7x+mmm9b9hOoaRhhYeNN2vcVVywu92B7WdACkyr0gAAVTH/3crbKnHorDiDRG0/b MerPGrsjH5XiwvICnOMehxgKcHiojLqMRzCcXYawSG7A64mG1SuEQ6MH5KZLyat9u+ +t64PsUDMXuwNmmbVGXMGjHLDayluWSf6DP8Mkb9A4jTuGY/J17aI3lwSGjPwXzlYl KM6PSP24glN8LzP24EGdRwbBxQpiuPPj/Hvq/1D9D9gItenJgLF3Oqe4NOIhVqAawh yRS5L5r6tJB7IkxvBi+rpvLVAM0kiy+S8Bdv3shcab5Yi/uHU/gQ/UpdIv3S6MDCX0 UMkCwrPZZkcgkeI0N3hnbiMc8BhFoq7441WGTWoOpo5nTn5/Z2t8aQsA4T64HMuw4Z 86WElNbG7yGvXB8tiMM6wO1CI8Um3qCznx5aCoHgLJ/7aPaDoCZuH0j2CHZT40OzGv U2ruamlgR1hkkYY3mBikglY4al9i414B3eMe9hTp9Yxma5GpUPqA1TDSw/qgOHjN2S bT/gRuzfR1vdM8+RWICRAusIi2qZS3/XiC4167hetm+uJkrgwgCKGNbmK2oTxpKdpk 7l/07qJNhnIDGQwLsP0PbhWE= Mail-Followup-To: Linus =?iso-8859-1?Q?Bj=F6rnstam?= , guile-user@gnu.org Content-Disposition: inline In-Reply-To: <1674e944-f9c5-415c-ad0d-5c26efac8306@app.fastmail.com> Received-SPF: pass client-ip=37.205.8.62; envelope-from=~@wolfsden.cz; helo=wolfsden.cz X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:19707 Archived-At: --BOZsqsgf3p5cQLm+ Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2024-06-06 22:02:50 +0200, Linus Bj=F6rnstam wrote: > Which version are you using? All my similar issues with srfi-9 went away = last year when srfi things were marked maybe-unused. I am using the latest 3.0.9. However thanks to your hint about maybe-unuse= d, I can see this: $ git log v3.0.9.. -- module/srfi/srfi-9.scm commit 7fef214f6e0df4004020fec530e808c476f2d2bf Author: Andy Wingo Date: Sun Mar 17 09:52:49 2024 +0100 Remove vestigial code from srfi-9 * module/srfi/srfi-9.scm (%define-record-type): No need to define record-layout. commit 19c7969fff223f28cad90e21ae04a0a5852901fc Author: Andy Wingo Date: Thu Aug 24 11:41:15 2023 +0200 define-inlinable marks residualized procedure as maybe-unused * module/ice-9/boot-9.scm (define-inlinable): * module/srfi/srfi-9.scm (define-tagged-inlinable): Add maybe-unused declaration. Also require at least one body expr, otherwise the metadata declaration could escape as the proc body. So it looks like this is not in any released version yet. And indeed, when= I try to compile it using the current master, the warning goes away. I wonder how to work around it in the mean time. I guess I could just put %foo?-procedure as a top-level expression. This seems to not produce any warnings: (define-module (x) #:use-module (srfi srfi-9) #:export ( foo? make-foo)) (define-record-type (make-foo) foo?) %foo?-procedure I guess there should be pretty much zero performance impact, correct? Are = there any side effects I might not be aware of? > > I don't have a computer this week so I cannot try your code. Sorry. No worries, you were helpful already, enjoy your no-computer time :) > > -- > Linus Bj=F6rnstam > > On Wed, 5 Jun 2024, at 17:02, Tomas Volf wrote: > > Hello, > > > > I am getting following warning from a guild compile: > > > > warning: possibly unused local top-level variable `%foo?-procedure' > > > > And I am not sure how to tackle it. This is my full source code: > > > > (define-module (x) > > #:use-module (srfi srfi-9) > > #:export ( > > foo? > > make-foo)) > > > > (define-record-type (make-foo) foo?) > > > > When I try to compile it: > > > > $ guild compile -W 3 -o x.go x.scm > > x.scm:7:0: warning: possibly unused local top-level variable > > `%foo?-procedure' > > wrote `x.go' > > > > I would (for obvious reasons) like to keep my compilation warning-free.= I can > > think of two approaches: > > > > 1. Export the %foo?-procedure > > I think this would confuse downstream users, since they are not ex= pected to > > use it directly. > > > > 2. Mark the procedure as used > > In C I could use `(void)proc;', is there an equivalent of that co= nstruct > > in Guile? > > > > Are there other options? How are you approaching it? > > > > Thank you and have a nice day, > > Tomas Volf > > > > PS: I am not even sure why this warning happens, the `foo?' syntax tran= sformer > > is exported and *does* reference it (as far as I can tell from ,expand). > > > > -- > > There are only two hard things in Computer Science: > > cache invalidation, naming things and off-by-one errors. > > > > Attachments: > > * signature.asc Have a nice day, Tomas Volf -- There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors. --BOZsqsgf3p5cQLm+ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEt4NJs4wUfTYpiGikL7/ufbZ/wakFAmZiPZkACgkQL7/ufbZ/ wakjdBAAkZ0quGWrA1UumN2qPH6EKLlrRTIIabgyC+saUzffy4UwkXu27hpuSwE9 jwJTUVRXYAy0lZzyzCVW6L9yxyYwByQD/b/O2X/pq1fsRo2V8U3qzODT8h2KiTKq GN8ZjCY0BQ45qLkF5AIWo1AT5U7M0QZfk/YyH5T8ZDundAIzqB4ZbZ/m8qb2BYFe 1D1IV+JKwO7DWSPc3TG6jxkI1IL3Y77+h32OXEgFGbF6SwVG1YnEUZ4LoXg+o9Gs 7UF87k1GBgjMPzVOsvsWOJRinjYft+xWOduHbVCwHfnA0mFODVT1r54R0i2BHCSd ZP8xsj69NlRBG+mUTkmc2GXRu70bXrDcg7AHw96vK0UuJweL3PMO5NUq/HK1SZ3i 1SkZMo1NN/TcxNnI3HwnXozUDwXLDCIcMXO8r+xxe6kw27NzonspjyC+qCCuiNxe HrL6+hbmWr4ybP8Gqg6DKFWYFklGctG2cnakrRn/oBADWwABv1knnGqIh3GxJJcs Cbuu1QE2ig7+PL1J5sjt8EVYWNW5KsYIU4kLjmO77e3nylAwat/mJh4aNze2UNeo jtGHsl7pHPZh2YB2ZqqAN9aECRHUVo/MlBplGoC8YjNWuIeZDCClV8g7e6pp2Agl jRvFUIZdNRfGF//uGo4XqNho2xjjjjqJrumjqsvKwjXBgegicm4= =svBx -----END PGP SIGNATURE----- --BOZsqsgf3p5cQLm+--