bug#75997: (ice-9 match): warning: unused variable `failure'
Tomas Volf <[email protected]> Fri, 28 Feb 2025 02:33:32 +0100
| Newsgroups | gmane.lisp.guile.bugs |
|---|---|
| Message-ID | <[email protected]> |
Ludovic Courtès <[email protected]> writes: > Tomas Volf <[email protected]> skribis: > >> (lambda (expr) >> (let* ((v expr) >> (failure >> (lambda () >> ((@@ (ice-9 match) throw) >> 'match-error >> "match" >> "no matching pattern" >> v) >> #f))) >> #f)) > > Hi! Currently the unused-variable warning pass is unable to determine > that ‘failure’ was introduced by expanding a macro and thus that no > warning should be emitted. > > It’s always been this way and I don’t know of a clear way to fix it. I cannot really help regarding the general case. However in this specific it would likely suffice to tweak the expansion to --8<---------------cut here---------------start------------->8--- (lambda (expr) (let* ((v expr) (failure (lambda () ((@@ (ice-9 match) throw) 'match-error "match" "no matching pattern" v) #f))) failure #f)) --8<---------------cut here---------------end--------------->8--- Should have zero performance impact due to optimizations (I would hope), but feels somewhat ugly. Tomas -- There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.
signature.asc
(application/pgp-signature, 853 B)
-----BEGIN PGP SIGNATURE----- iQJCBAEBCgAsFiEEt4NJs4wUfTYpiGikL7/ufbZ/wakFAmfBEmwOHH5Ad29sZnNk ZW4uY3oACgkQL7/ufbZ/waksuw//TT38tBOHLv/Vv+DvJ4QyPyATjN6QI+nPrxjx PJJfCedBoXQ5DwOucATU6+en18t0CCajunxNKMKkQokTYOUxHvaStV6pXBSwx9pX 7T97whZEl3mnzqqZrcLMjHwcpuSfU6QBTY3u5WC0XVuzfA5WFN3a7m3t4ca0VpTb Nbq02coTRUZ/AypLp0mipMC9gwIFgXEbHoDAg56gImuhV/9zvYG/gND+hrZKI0aq baOj2E1zEWH4hUeePZj+J8dmTIWHJH0XuXbSKkR5RGQXEcJk/d6SuMyygCSkoIwQ 5oBKWxwLD7553bZcq4b9CU75YiTqa4/vcu+j4ItiLZULyo95msxrpHqubvxvr0WV /+81n5mRRT/HlaT6r/13/il2EcJJgitDeO/Cd5KvudVrPs3QuK2E1dQ/v1fyOkIO COLW7eLCI/H6eK1zKJwwHCLEPxVZuMkGvUlLt1+6BUdrHEmM4RqQrhhZUIyKrf9T ZhadPtb6Zms4g/XE2beTQMBsIxpQBzKg6PZBKejf8mE+VxP5ykeItYRBATU97D1z 4HfmrJ2xtANkdtq9hLFyIzgmnfGxiepeTIPGMhfw4V2Zleas5gYGMrcq6ojakvyQ vi4wr2QecugLFXVC2MXg3KXgdxaOp0BZvF9R13PrdUTrUZVVZF0aHj9jCdzSRJ30 7UZT5vI= =9v2G -----END PGP SIGNATURE-----