]> git.eshelyaron.com Git - emacs.git/commitdiff
Markus Triska <markus.triska at gmx.at>
authorGlenn Morris <rgm@gnu.org>
Fri, 21 Sep 2007 04:24:53 +0000 (04:24 +0000)
committerGlenn Morris <rgm@gnu.org>
Fri, 21 Sep 2007 04:24:53 +0000 (04:24 +0000)
(byte-compile-normal-call): Warn when `mapcar' is called for effect.

lisp/ChangeLog
lisp/emacs-lisp/bytecomp.el

index 0fdd025d0beaa0237f864fbce110ce12a701a3a5..f238531667afc64c9b589d7ae66ab397785e9629 100644 (file)
@@ -1,3 +1,8 @@
+2007-09-21  Markus Triska  <markus.triska@gmx.at>
+
+       * emacs-lisp/bytecomp.el (byte-compile-normal-call): Warn when
+       `mapcar' is called for effect.
+
 2007-09-21  Glenn Morris  <rgm@gnu.org>
 
        * obsolete/sun-fns.el (emacs-quit-menu): Remove emacstool-related code.
index 2c14bb666097f4b5988afa137e9a1bf6910028b2..10b65d4c47e3b95daddb34f1899ca3246f8851b6 100644 (file)
@@ -2831,6 +2831,10 @@ That command is designed for interactive use only" fn))
 (defun byte-compile-normal-call (form)
   (if byte-compile-generate-call-tree
       (byte-compile-annotate-call-tree form))
+  (when (and for-effect (eq (car form) 'mapcar))
+    (byte-compile-set-symbol-position 'mapcar)
+    (byte-compile-warn
+     "`mapcar' called for effect; use `mapc' or `dolist' instead"))
   (byte-compile-push-constant (car form))
   (mapc 'byte-compile-form (cdr form)) ; wasteful, but faster.
   (byte-compile-out 'byte-call (length (cdr form))))