[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to avoid compiler warning `unused lexical variable' for `dolist'
From: |
Philipp Stephani |
Subject: |
Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'? |
Date: |
Fri, 8 Jan 2021 14:31:14 +0100 |
Am Fr., 8. Jan. 2021 um 14:14 Uhr schrieb <tomas@tuxteam.de>:
> Fixing the macro definition is a bit more attractive (e.g.
> it could try to decide whether RESULT depends on i and
> not generate that let-binding if not), but I can't decide
> right now whether that involves the halting problem or not.
Certainly not, since that's what the byte compiler is doing. It's just
a lexical walk through the code after macroexpansion.
(require 'cconv)
(let ((env '((VAR nil nil nil nil))))
(cconv-analyze-form (macroexpand-all RESULT-FORM t) env)
(cadr (assq VAR env)))
Should return t if VAR is used in RESULT-FORM.
But then, I don't know whether that's worth it or not. Alternatively,
you could add an (ignore VAR) to the macro expansion of the result
form so that cconv treats the variable as used.
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, (continued)
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Jean Louis, 2021/01/08
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Stefan Monnier, 2021/01/08
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Emanuel Berg, 2021/01/08
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, tomas, 2021/01/08
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Emanuel Berg, 2021/01/08
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, tomas, 2021/01/08
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?,
Philipp Stephani <=
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Emanuel Berg, 2021/01/08
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Emanuel Berg, 2021/01/08
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Philipp Stephani, 2021/01/08
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Emanuel Berg, 2021/01/08
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, tomas, 2021/01/08
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Jean Louis, 2021/01/09
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Leo Butler, 2021/01/09
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Philipp Stephani, 2021/01/09
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Leo Butler, 2021/01/09
- Re: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?, Stefan Monnier, 2021/01/09