aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2007-09-21 04:24:53 +0000
committerGlenn Morris2007-09-21 04:24:53 +0000
commit89c91fdb5982cc5233ad6181dd5b845813ae8eee (patch)
tree6ae81760b1c9dda3ff519f2c8e187a4964907a86
parent195279a8d76378308dbb77f33d9058d1c5f098a8 (diff)
downloademacs-89c91fdb5982cc5233ad6181dd5b845813ae8eee.tar.gz
emacs-89c91fdb5982cc5233ad6181dd5b845813ae8eee.zip
Markus Triska <markus.triska at gmx.at>
(byte-compile-normal-call): Warn when `mapcar' is called for effect.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/emacs-lisp/bytecomp.el4
2 files changed, 9 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0fdd025d0be..f238531667a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12007-09-21 Markus Triska <markus.triska@gmx.at>
2
3 * emacs-lisp/bytecomp.el (byte-compile-normal-call): Warn when
4 `mapcar' is called for effect.
5
12007-09-21 Glenn Morris <rgm@gnu.org> 62007-09-21 Glenn Morris <rgm@gnu.org>
2 7
3 * obsolete/sun-fns.el (emacs-quit-menu): Remove emacstool-related code. 8 * obsolete/sun-fns.el (emacs-quit-menu): Remove emacstool-related code.
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))
2831(defun byte-compile-normal-call (form) 2831(defun byte-compile-normal-call (form)
2832 (if byte-compile-generate-call-tree 2832 (if byte-compile-generate-call-tree
2833 (byte-compile-annotate-call-tree form)) 2833 (byte-compile-annotate-call-tree form))
2834 (when (and for-effect (eq (car form) 'mapcar))
2835 (byte-compile-set-symbol-position 'mapcar)
2836 (byte-compile-warn
2837 "`mapcar' called for effect; use `mapc' or `dolist' instead"))
2834 (byte-compile-push-constant (car form)) 2838 (byte-compile-push-constant (car form))
2835 (mapc 'byte-compile-form (cdr form)) ; wasteful, but faster. 2839 (mapc 'byte-compile-form (cdr form)) ; wasteful, but faster.
2836 (byte-compile-out 'byte-call (length (cdr form)))) 2840 (byte-compile-out 'byte-call (length (cdr form))))