GNU bug report logs - #16206
24.3; Incorrect unused variable byte-compiler warning in dotimes

Previous Next

Package: emacs;

Reported by: Christopher Wellons <wellons <at> nullprogram.com>

Date: Fri, 20 Dec 2013 21:08:01 UTC

Severity: minor

Merged with 31232, 39919, 41287

Found in versions 24.3, 26.3, 28.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: Christopher Wellons <wellons <at> nullprogram.com>, 16206 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: bug#16206: 24.3; Incorrect unused variable byte-compiler warning in dotimes
Date: Wed, 25 Apr 2018 02:11:38 +0200
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:

> > -the return value (nil if RESULT is omitted).
> > +the return value (nil if RESULT is omitted).  Note that RESULT
> > +should not be used unless it makes use of VAR.
>
> I would drop the "unless it makes use of VAR".

Yes.

For example,

#+begin_src emacs-lisp
(let ((count 10) (result 0))
   (dotimes (i count result)
     (print i)
     (setq result (+ result i))))
#+end_src

produces the warning - but doesn't RESULT "make use of the VAR"?

With the suggested patch, we would have a strange macro argument, using
it can produce strange compiler warnings, and we would have an obscure
description how these should be avoided.  It has to stop.


Michael.




This bug report was last modified 4 years and 236 days ago.

Previous Next


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