aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2007-09-21 07:13:28 +0000
committerGlenn Morris2007-09-21 07:13:28 +0000
commit86da2828de2ef43b44030163448b66edb001b643 (patch)
tree36e3f3d4bc7f7ac8750a36916bf38d23e69d1c9b
parent220a31ac488120a58e5a5dd36f7176d0e3235f8d (diff)
downloademacs-86da2828de2ef43b44030163448b66edb001b643.tar.gz
emacs-86da2828de2ef43b44030163448b66edb001b643.zip
(byte-compile-warnings)
(byte-compile-warnings-safe-p): Add `mapcar'. (byte-compile-normal-call): Add option to suppress mapcar warning. (top-level): Use mapc rather than mapcar in eval-when-compile.
-rw-r--r--lisp/emacs-lisp/bytecomp.el36
1 files changed, 20 insertions, 16 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 10b65d4c47e..31ee364cd2f 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -103,6 +103,7 @@
103;; not good to call from Lisp) 103;; not good to call from Lisp)
104;; `make-local' (dubious calls to 104;; `make-local' (dubious calls to
105;; `make-variable-buffer-local') 105;; `make-variable-buffer-local')
106;; `mapcar' (mapcar called for effect)
106;; byte-compile-compatibility Whether the compiler should 107;; byte-compile-compatibility Whether the compiler should
107;; generate .elc files which can be loaded into 108;; generate .elc files which can be loaded into
108;; generic emacs 18. 109;; generic emacs 18.
@@ -359,7 +360,8 @@ Elements of the list may be:
359 distinguished from macros and aliases). 360 distinguished from macros and aliases).
360 interactive-only 361 interactive-only
361 commands that normally shouldn't be called from Lisp code. 362 commands that normally shouldn't be called from Lisp code.
362 make-local calls to make-variable-buffer-local that may be incorrect." 363 make-local calls to make-variable-buffer-local that may be incorrect.
364 mapcar mapcar called for effect."
363 :group 'bytecomp 365 :group 'bytecomp
364 :type `(choice (const :tag "All" t) 366 :type `(choice (const :tag "All" t)
365 (set :menu-tag "Some" 367 (set :menu-tag "Some"
@@ -367,7 +369,7 @@ Elements of the list may be:
367 (const callargs) (const redefine) 369 (const callargs) (const redefine)
368 (const obsolete) (const noruntime) 370 (const obsolete) (const noruntime)
369 (const cl-functions) (const interactive-only) 371 (const cl-functions) (const interactive-only)
370 (const make-local)))) 372 (const make-local) (const mapcar))))
371(put 'byte-compile-warnings 'safe-local-variable 'byte-compile-warnings-safe-p) 373(put 'byte-compile-warnings 'safe-local-variable 'byte-compile-warnings-safe-p)
372;;;###autoload 374;;;###autoload
373(defun byte-compile-warnings-safe-p (x) 375(defun byte-compile-warnings-safe-p (x)
@@ -378,7 +380,8 @@ Elements of the list may be:
378 (when (memq e '(free-vars unresolved 380 (when (memq e '(free-vars unresolved
379 callargs redefine 381 callargs redefine
380 obsolete noruntime 382 obsolete noruntime
381 cl-functions interactive-only make-local)) 383 cl-functions interactive-only
384 make-local mapcar))
382 e)) 385 e))
383 x) 386 x)
384 x)))) 387 x))))
@@ -2831,7 +2834,8 @@ That command is designed for interactive use only" fn))
2831(defun byte-compile-normal-call (form) 2834(defun byte-compile-normal-call (form)
2832 (if byte-compile-generate-call-tree 2835 (if byte-compile-generate-call-tree
2833 (byte-compile-annotate-call-tree form)) 2836 (byte-compile-annotate-call-tree form))
2834 (when (and for-effect (eq (car form) 'mapcar)) 2837 (when (and for-effect (eq (car form) 'mapcar)
2838 (memq 'mapcar byte-compile-warnings))
2835 (byte-compile-set-symbol-position 'mapcar) 2839 (byte-compile-set-symbol-position 'mapcar)
2836 (byte-compile-warn 2840 (byte-compile-warn
2837 "`mapcar' called for effect; use `mapc' or `dolist' instead")) 2841 "`mapcar' called for effect; use `mapc' or `dolist' instead"))
@@ -4238,18 +4242,18 @@ and corresponding effects."
4238 (assq 'byte-code (symbol-function 'byte-compile-form)) 4242 (assq 'byte-code (symbol-function 'byte-compile-form))
4239 (let ((byte-optimize nil) ; do it fast 4243 (let ((byte-optimize nil) ; do it fast
4240 (byte-compile-warnings nil)) 4244 (byte-compile-warnings nil))
4241 (mapcar (lambda (x) 4245 (mapc (lambda (x)
4242 (or noninteractive (message "compiling %s..." x)) 4246 (or noninteractive (message "compiling %s..." x))
4243 (byte-compile x) 4247 (byte-compile x)
4244 (or noninteractive (message "compiling %s...done" x))) 4248 (or noninteractive (message "compiling %s...done" x)))
4245 '(byte-compile-normal-call 4249 '(byte-compile-normal-call
4246 byte-compile-form 4250 byte-compile-form
4247 byte-compile-body 4251 byte-compile-body
4248 ;; Inserted some more than necessary, to speed it up. 4252 ;; Inserted some more than necessary, to speed it up.
4249 byte-compile-top-level 4253 byte-compile-top-level
4250 byte-compile-out-toplevel 4254 byte-compile-out-toplevel
4251 byte-compile-constant 4255 byte-compile-constant
4252 byte-compile-variable-ref)))) 4256 byte-compile-variable-ref))))
4253 nil) 4257 nil)
4254 4258
4255(run-hooks 'bytecomp-load-hook) 4259(run-hooks 'bytecomp-load-hook)