1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Markus Triska <markus.triska at gmx.at>

(byte-compile-normal-call): Warn when `mapcar' is called for effect.
This commit is contained in:
Glenn Morris 2007-09-21 04:24:53 +00:00
parent 195279a8d7
commit 89c91fdb59
2 changed files with 9 additions and 0 deletions

View 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))))