emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Compiler warnings in nnir.el (was: nnir.el cleanup)


From: Reiner Steib
Subject: Compiler warnings in nnir.el (was: nnir.el cleanup)
Date: Thu, 24 Apr 2008 20:17:30 +0200
User-agent: Gnus/5.110009 (No Gnus v0.9) Emacs/22.2.50 (gnu/linux)

[ Cc-ing emacs-devel ]

On Tue, Apr 22 2008, Christoph Conrad wrote:

>> Could you provide a patch that fixes/silences the Emacs 23 compiler
>> warnings?
> [...] One warning remains, i don't understand why.
>
> In nnir-run-namazu:
> nnir.el:1475:28:Warning: reference to free variable `dirnam'
> nnir.el:1475:28:Warning: reference to free variable `artno'
>
> Possibly it has to do with the usage of nnir-add-result, a macro, but i
> don't understand why.

Here's a simplified test case of the problem in contrib/nnir.el[1].
Maybe someone on emacs-devel can explain whether we should silence the
compiler warnings, modify the code or if the byte-compiler should be
improved.

--8<---------------cut here---------------start------------->8---
(defmacro nnir-add-result-dummy (dirnam artno score prefix server artlist)
  "Ask `nnir-compose-result' to construct a result vector, 
and if it is non-nil, add it to artlist."
  `(let ((result (nnir-compose-result-dummy dirnam artno score prefix server)))
     (when (not (null result))
       (push result artlist))))

(defun nnir-compose-result-dummy (dirnam article score prefix server)
  t)

(defun nnir-run-namazu-dummy (query server &optional group)
  (let ((article-pattern "^[0-9]+$")
        artlist
        (qstring (cdr (assq 'query query)))
        (prefix "nnfoobar")
        score group article)
    (nnir-add-result-dummy group article score prefix server artlist)))
--8<---------------cut here---------------end--------------->8---

In Emacs 22.2.50, I get:

,----
| Compiling file nnir-warnings.el at Thu Apr 24 20:08:09 2008
| 
| In nnir-run-namazu-dummy:
| nnir-warnings.el:12:10:Warning: reference to free variable `dirnam'
| nnir-warnings.el:12:10:Warning: reference to free variable `artno'
`----

Bye, Reiner.

[1] From contrib/ in the Gnus repository.  nnir.el is not included in
    Emacs yet, since we wait for an assignment.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]