changeset 84736:247a13281cd8

Markus Triska <markus.triska at gmx.at> (byte-compile-normal-call): Warn when `mapcar' is called for effect.
author Glenn Morris <rgm@gnu.org>
date Fri, 21 Sep 2007 04:24:18 +0000
parents 7d321919d0e7
children 79b2134c2bc8
files lisp/emacs-lisp/bytecomp.el
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/bytecomp.el	Fri Sep 21 04:07:11 2007 +0000
+++ b/lisp/emacs-lisp/bytecomp.el	Fri Sep 21 04:24:18 2007 +0000
@@ -2831,6 +2831,10 @@
 (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))))