Commit 89c91fdb authored by Glenn Morris's avatar Glenn Morris
Browse files

Markus Triska <markus.triska at gmx.at>

(byte-compile-normal-call): Warn when `mapcar' is called for effect.
parent 195279a8
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.
......
......@@ -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))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment