GNU bug report logs - #18968
25.0.50; unhelpful "unused" warning from byte compiler

Previous Next

Package: emacs;

Reported by: Tom Tromey <tom <at> tromey.com>

Date: Thu, 6 Nov 2014 02:47:01 UTC

Severity: minor

Found in version 25.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 18968 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Tom Tromey <tom <at> tromey.com>
Cc: 18968 <at> debbugs.gnu.org
Subject: Re: bug#18968: 25.0.50; unhelpful "unused" warning from byte compiler
Date: Wed, 05 Nov 2014 22:28:50 -0500
> Byte-compile this program:

> (defvar q-x)
> (defun z ()
>   (pop (aref q-x 0))
>   nil)

> I get:

> q.el:2:8:Warning: value returned from (aref v 0) is unused

> I think this warning is not very useful;

I'd tend to agree, tho it turned out it was useful because it pointed
out that (aref v 0) was called twice by the macro-expanded code instead
of only once.

So I installed the patch below which should fix the underlying problem.


        Stefan


=== modified file 'lisp/subr.el'
--- lisp/subr.el	2014-10-30 05:15:28 +0000
+++ lisp/subr.el	2014-11-06 03:25:36 +0000
@@ -169,7 +169,8 @@
          ;; So we can use `pop' in the bootstrap before `gv' can be used.
          (list 'prog1 place (list 'setq place (list 'cdr place)))
        (gv-letplace (getter setter) place
-         `(prog1 ,getter ,(funcall setter `(cdr ,getter)))))))
+         (macroexp-let2 macroexp-copyable-p x getter
+           `(prog1 ,x ,(funcall setter `(cdr ,x))))))))
 
 (defmacro when (cond &rest body)
   "If COND yields non-nil, do BODY, else return nil.





This bug report was last modified 10 years and 255 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.