diff options
author | Glenn Morris <rgm@gnu.org> | 2007-09-21 07:13:28 +0000 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2007-09-21 07:13:28 +0000 |
commit | 86da2828de2ef43b44030163448b66edb001b643 (patch) | |
tree | 36e3f3d4bc7f7ac8750a36916bf38d23e69d1c9b /lisp/emacs-lisp | |
parent | 220a31ac488120a58e5a5dd36f7176d0e3235f8d (diff) | |
download | emacs-86da2828de2ef43b44030163448b66edb001b643.tar.gz emacs-86da2828de2ef43b44030163448b66edb001b643.tar.bz2 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.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 36 |
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 @@ ;; not good to call from Lisp) ;; `make-local' (dubious calls to ;; `make-variable-buffer-local') +;; `mapcar' (mapcar called for effect) ;; byte-compile-compatibility Whether the compiler should ;; generate .elc files which can be loaded into ;; generic emacs 18. @@ -359,7 +360,8 @@ Elements of the list may be: distinguished from macros and aliases). interactive-only commands that normally shouldn't be called from Lisp code. - make-local calls to make-variable-buffer-local that may be incorrect." + make-local calls to make-variable-buffer-local that may be incorrect. + mapcar mapcar called for effect." :group 'bytecomp :type `(choice (const :tag "All" t) (set :menu-tag "Some" @@ -367,7 +369,7 @@ Elements of the list may be: (const callargs) (const redefine) (const obsolete) (const noruntime) (const cl-functions) (const interactive-only) - (const make-local)))) + (const make-local) (const mapcar)))) (put 'byte-compile-warnings 'safe-local-variable 'byte-compile-warnings-safe-p) ;;;###autoload (defun byte-compile-warnings-safe-p (x) @@ -378,7 +380,8 @@ Elements of the list may be: (when (memq e '(free-vars unresolved callargs redefine obsolete noruntime - cl-functions interactive-only make-local)) + cl-functions interactive-only + make-local mapcar)) e)) x) x)))) @@ -2831,7 +2834,8 @@ 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)) + (when (and for-effect (eq (car form) 'mapcar) + (memq 'mapcar byte-compile-warnings)) (byte-compile-set-symbol-position 'mapcar) (byte-compile-warn "`mapcar' called for effect; use `mapc' or `dolist' instead")) @@ -4238,18 +4242,18 @@ and corresponding effects." (assq 'byte-code (symbol-function 'byte-compile-form)) (let ((byte-optimize nil) ; do it fast (byte-compile-warnings nil)) - (mapcar (lambda (x) - (or noninteractive (message "compiling %s..." x)) - (byte-compile x) - (or noninteractive (message "compiling %s...done" x))) - '(byte-compile-normal-call - byte-compile-form - byte-compile-body - ;; Inserted some more than necessary, to speed it up. - byte-compile-top-level - byte-compile-out-toplevel - byte-compile-constant - byte-compile-variable-ref)))) + (mapc (lambda (x) + (or noninteractive (message "compiling %s..." x)) + (byte-compile x) + (or noninteractive (message "compiling %s...done" x))) + '(byte-compile-normal-call + byte-compile-form + byte-compile-body + ;; Inserted some more than necessary, to speed it up. + byte-compile-top-level + byte-compile-out-toplevel + byte-compile-constant + byte-compile-variable-ref)))) nil) (run-hooks 'bytecomp-load-hook) |