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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18968 in the body.
You can then email your comments to 18968 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#18968; Package emacs. (Thu, 06 Nov 2014 02:47:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tom Tromey <tom <at> tromey.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 06 Nov 2014 02:47:02 GMT) Full text and rfc822 format available.

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

From: Tom Tromey <tom <at> tromey.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.0.50; unhelpful "unused" warning from byte compiler
Date: Wed, 05 Nov 2014 19:45:36 -0700
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; while it is true that the aref
result is not used, it's still convenient to use 'pop', there isn't a
convenient substitute, and so there isn't anything useful to be done
about this warning.




In GNU Emacs 25.0.50.7 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.9)
 of 2014-11-02 on bapiya
Repository revision: 118270 larsi <at> gnus.org-20141103010307-bxryy53hat500i4w
Windowing system distributor `Fedora Project', version 11.0.11404000
Configured using:
 `configure --prefix=/home/tromey/Emacs/install'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=none
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  flyspell-mode: t
  which-function-mode: t
  global-auto-revert-mode: t
  desktop-save-mode: t
  erc-services-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-networks-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-match-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  savehist-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  auto-fill-function: do-auto-fill

Recent input:
- a l l SPC ' ( p o p SPC ( a r e f SPC v e c SPC 0 
) ) M-b M-d 6 C-e <backspace> ) ) C-j C-z n C-x b b 
y t <tab> <tab> - c o <backspace> <backspace> c <backspace> 
<backspace> c o m <tab> <return> C-s v a l u e SPC 
r e t u r n e d C-s M-x l g r e p <return> v a l u 
e SPC r e t u r n e d <return> <return> <return> C-x 
o C-x 1 C-u C-u C-n C-u C-n C-n C-c C-c C-x C-g C-s 
C-w C-w C-a C-u C-p C-x 1 C-n C-l C-s e r r o r - f 
r e e C-s C-s C-r C-r C-r C-r C-x b q . e <tab> <return> 
C-g C-x C-f M-p M-p M-p M-p M-p M-p M-n <return> C-e 
C-a C-o ( d e f u n SPC z SPC ( ) C-n TAB C-e <return> 
C-p C-p C-a C-o ( d e f v a r SPC x ) C-n C-n C-e M-b 
5 SPC M-d x C-e <return> n i l ) <return> C-f C-x C-o 
C-x C-s <switch-frame> <switch-frame> M-< C-k C-k C-n 
C-x C-s C-z n C-z n C-p C-o ( d e f u n <backspace> 
v <backspace> <backspace> v a r SPC q q <backspace> 
- x ) C-n C-n C-b C-b q - C-x C-s C-a C-k <tab> ( p 
o p SPC q - x ) C-x C-s <switch-frame> C-z n M-b ( 
<backspace> M-b ( a r e f SPC C-e C-b C-e SPC 0 ) C-x 
C-s <switch-frame> <switch-frame> M-b C-b C-t C-t C-x 
C-s C-z n M-x r e p o r <tab> <return>

Recent messages:
Wrote /home/tromey/Emacs/ET/q.el
Saving file /home/tromey/Emacs/ET/q.el...
Wrote /home/tromey/Emacs/ET/q.el
Auto-saving...done
Saving file /home/tromey/Emacs/ET/q.el...
Wrote /home/tromey/Emacs/ET/q.el
Saving file /home/tromey/Emacs/ET/q.el...
Wrote /home/tromey/Emacs/ET/q.el
Saving file /home/tromey/Emacs/ET/q.el...
Wrote /home/tromey/Emacs/ET/q.el

Load-path shadows:
/home/tromey/.emacs.d/elpa/css-mode-1.0/css-mode hides /home/tromey/Emacs/install/share/emacs/25.0.50/lisp/textmodes/css-mode
/home/tromey/.emacs.d/elpa/bubbles-0.5/bubbles hides /home/tromey/Emacs/install/share/emacs/25.0.50/lisp/play/bubbles

Features:
(mailalias view xterm shadow emacsbug python json elcomp mail-hist
find-dired pcmpl-unix pcmpl-gnu shell make-mode flow-fill mule-util
bbdb-gui bbdb-hooks sort gnus-cite smiley shr-color color shr browse-url
mm-archive gnus-async gnus-bcklg qp gnus-ml disp-table gnus-topic
nndraft nnmh nnfolder utf-7 bbdb-gnus bbdb-snarf mail-extr bbdb-com
warnings cl gnutls network-stream starttls gnus-agent gnus-srvr
gnus-score score-mode nnvirtual gnus-msg nntp gnus-cache gnus-registry
registry eieio-base gnus-art mm-uu mml2015 mm-view mml-smime smime dig
mailcap gnus-sum gnus-group gnus-undo smtpmail sendmail gnus-start
gnus-cloud nnimap nnmail mail-source tls utf7 netrc nnoo parse-time
gnus-spec gnus-int gnus-range gnus-win gnus gnus-ems nnheader idutils
derived log-edit message rfc822 mml mml-sec mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev
mail-utils gmm-utils mailheader pcvs-util eieio-opt speedbar sb-image
ezimage dframe dabbrev help-mode debug copyright misearch multi-isearch
edebug texinfo sh-script smie executable sgml-mode org-element org-rmail
org-mhe org-irc org-info org-gnus org-docview doc-view image-mode
org-bibtex bibtex org-bbdb org-w3m org org-macro org-footnote
org-pcomplete org-list org-faces org-entities noutline outline
org-version ob-emacs-lisp ob ob-tangle ob-ref ob-lob ob-table ob-exp
org-src ob-keys ob-comint ob-core ob-eval org-compat org-macs
org-loaddefs smerge-mode diff-mode easy-mmode bug-reference goto-addr
add-log vc-arch vc-mtn vc-hg jka-compr dired vc-sccs vc-svn vc-cvs
vc-rcs vc-bzr cc-mode cc-fonts cc-guess cc-menus cc-cmds vc-git flyspell
ispell diminish projectile edmacro kmacro pkg-info find-func lisp-mnt
epl grep compile dash s appt diary-lib diary-loaddefs cal-menu calendar
cal-loaddefs which-func imenu minimap autorevert filenotify desktop
frameset cus-start cus-load status erc-services erc-list erc-menu
erc-join erc-ring erc-networks erc-pcomplete pcomplete erc-track
erc-match erc-button wid-edit erc-fill erc-stamp erc-netsplit
erc-goodies erc erc-backend erc-compat format-spec auth-source cl-macs
gv eieio byte-opt bytecomp byte-compile cl-extra cconv eieio-core
cl-loaddefs cl-lib gnus-util mm-util mail-prsvr password-cache thingatpt
pp advice help-fns vc-dir ewoc vc vc-dispatcher cc-styles cc-align
cc-engine cc-vars cc-defs bbdb timezone ange-ftp comint ansi-color ring
server savehist dwarf-mode-autoloads gdb-shell-autoloads
jabber-autoloads lisppaste-autoloads pydoc-info-autoloads info-look info
easymenu weblogger-autoloads package epg-config bbdb-autoloads time-date
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
gfilenotify dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 1079236 147373)
 (symbols 48 101416 18)
 (miscs 40 42437 4907)
 (strings 32 315780 71503)
 (string-bytes 1 7486012)
 (vectors 16 97717)
 (vector-slots 8 2099698 83288)
 (floats 8 573 1002)
 (intervals 56 64171 4427)
 (buffers 976 232)
 (heap 1024 260330 33179))

Tom




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18968; Package emacs. (Thu, 06 Nov 2014 03:29:01 GMT) Full text and rfc822 format available.

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.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18968; Package emacs. (Thu, 06 Nov 2014 14:38:02 GMT) Full text and rfc822 format available.

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

From: Tom Tromey <tom <at> tromey.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Tom Tromey <tom <at> tromey.com>, 18968 <at> debbugs.gnu.org
Subject: Re: bug#18968: 25.0.50; unhelpful "unused" warning from byte compiler
Date: Thu, 06 Nov 2014 07:37:14 -0700
Stefan> I'd tend to agree, tho it turned out it was useful because it pointed
Stefan> out that (aref v 0) was called twice by the macro-expanded code instead
Stefan> of only once.

Thanks for looking deeper.
That hadn't occurred to me.

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

It worked for me.

Tom




bug closed, send any further explanations to 18968 <at> debbugs.gnu.org and Tom Tromey <tom <at> tromey.com> Request was from Stefan Monnier <monnier <at> iro.umontreal.ca> to control <at> debbugs.gnu.org. (Thu, 06 Nov 2014 15:28:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 05 Dec 2014 12:24:05 GMT) Full text and rfc822 format available.

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

Previous Next


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