From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Glenn Morris Newsgroups: gmane.emacs.bugs Subject: bug#28107: 26.0.50; Byte compilation shows an unused var warning for an used variable Date: Thu, 17 Aug 2017 12:39:58 -0400 Message-ID: References: <87d17wyrbw.fsf@calancha-pc> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1502988072 27400 195.159.176.226 (17 Aug 2017 16:41:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 17 Aug 2017 16:41:12 +0000 (UTC) User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) Cc: 28107@debbugs.gnu.org To: Tino Calancha Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Aug 17 18:41:05 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1diNqw-0006er-JF for geb-bug-gnu-emacs@m.gmane.org; Thu, 17 Aug 2017 18:41:02 +0200 Original-Received: from localhost ([::1]:34451 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1diNr2-0005hS-VX for geb-bug-gnu-emacs@m.gmane.org; Thu, 17 Aug 2017 12:41:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44287) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1diNqx-0005h8-Cp for bug-gnu-emacs@gnu.org; Thu, 17 Aug 2017 12:41:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1diNqw-0006OQ-KW for bug-gnu-emacs@gnu.org; Thu, 17 Aug 2017 12:41:03 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34327) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1diNqw-0006Ny-GX for bug-gnu-emacs@gnu.org; Thu, 17 Aug 2017 12:41:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1diNqw-0002iI-0c for bug-gnu-emacs@gnu.org; Thu, 17 Aug 2017 12:41:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Glenn Morris Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 17 Aug 2017 16:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28107 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 28107-submit@debbugs.gnu.org id=B28107.150298801610346 (code B ref 28107); Thu, 17 Aug 2017 16:41:01 +0000 Original-Received: (at 28107) by debbugs.gnu.org; 17 Aug 2017 16:40:16 +0000 Original-Received: from localhost ([127.0.0.1]:43008 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1diNqC-0002go-3Z for submit@debbugs.gnu.org; Thu, 17 Aug 2017 12:40:16 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:53176) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1diNqA-0002gX-MJ for 28107@debbugs.gnu.org; Thu, 17 Aug 2017 12:40:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1diNpz-0004Pa-Nk for 28107@debbugs.gnu.org; Thu, 17 Aug 2017 12:40:09 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:47096) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1diNpw-0004K7-6V; Thu, 17 Aug 2017 12:40:00 -0400 Original-Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1diNpu-0003Lg-Dz; Thu, 17 Aug 2017 12:39:58 -0400 X-Spook: Gazprom Conficker electronic surveillance unclassified X-Ran: 4FQN|s7/qn{ayI%[ea|YF"%JrJ+lr;M/Dxz$VNq1sW#,:8L&AN@.Xi>LB'_59PjVW_*kf" X-Hue: yellow X-Attribution: GM In-Reply-To: <87d17wyrbw.fsf@calancha-pc> (Tino Calancha's message of "Wed, 16 Aug 2017 15:11:47 +0900") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:135877 Archived-At: Tino Calancha wrote: > ;; Warning: value returned from (cdr x) is unused > (defun test2 () > (let ((alist (list (cons "foo" 1) (cons "bar" 2)))) > (dolist (x alist) > (when (cdr x) > (equal (cdr x) (alist-get (car x) alist)))))) Isn't this function a no-op? Eg dolist does not return the last value from the body. So a smaller example of the same thing is: (dolist (x '(1)) (equal (+ x 2) 3)) which returns nil. > ;; Compiles OK > (defun getval (x) (cdr x)) > (defun test3 () > (let ((alist (list (cons "foo" 1) (cons "bar" 2)))) > (dolist (x alist) > (when (getval x) > (equal (getval x) (alist-get (car x) alist)))))) If getcdr is known to be side-effect-free, you get the same warning. (eval-when-compile (put 'getcdr 'side-effect-free t)) So I think this is a (slightly inaccurate) warning of a real issue.