summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2007-09-21 04:24:53 +0000
committerGlenn Morris <rgm@gnu.org>2007-09-21 04:24:53 +0000
commit89c91fdb5982cc5233ad6181dd5b845813ae8eee (patch)
tree6ae81760b1c9dda3ff519f2c8e187a4964907a86 /lisp/emacs-lisp
parent195279a8d76378308dbb77f33d9058d1c5f098a8 (diff)
downloademacs-89c91fdb5982cc5233ad6181dd5b845813ae8eee.tar.gz
emacs-89c91fdb5982cc5233ad6181dd5b845813ae8eee.tar.bz2
emacs-89c91fdb5982cc5233ad6181dd5b845813ae8eee.zip
Markus Triska <markus.triska at gmx.at>
(byte-compile-normal-call): Warn when `mapcar' is called for effect.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/bytecomp.el4
1 files changed, 4 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 2c14bb66609..10b65d4c47e 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -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))))