aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2012-11-08 09:58:15 -0500
committerStefan Monnier2012-11-08 09:58:15 -0500
commite703069f9c23dd94b65e1d81ce57758c7f905bb2 (patch)
tree6d5e45992ff4045abc36d62924de4b494f95fed2
parenta9a5c7f69099233a10d54b1c0e2792fdd88454b9 (diff)
downloademacs-e703069f9c23dd94b65e1d81ce57758c7f905bb2.tar.gz
emacs-e703069f9c23dd94b65e1d81ce57758c7f905bb2.zip
* lisp/emacs-lisp/bytecomp.el (byte-compile-initial-macro-environment):
Byte-compile *before* eval in eval-and-compile. (byte-compile-log-warning): Remove redundant inhibit-read-only. (byte-compile-file-form-autoload): Don't hide actual definition. (byte-compile-maybe-guarded): Accept `functionp' as well.
-rw-r--r--lisp/emacs-lisp/bytecomp.el39
1 files changed, 27 insertions, 12 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index e776df4ef37..9baa95dffaa 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -419,8 +419,8 @@ This list lives partly on the stack.")
419 419
420(defconst byte-compile-initial-macro-environment 420(defconst byte-compile-initial-macro-environment
421 '( 421 '(
422;; (byte-compiler-options . (lambda (&rest forms) 422 ;; (byte-compiler-options . (lambda (&rest forms)
423;; (apply 'byte-compiler-options-handler forms))) 423 ;; (apply 'byte-compiler-options-handler forms)))
424 (declare-function . byte-compile-macroexpand-declare-function) 424 (declare-function . byte-compile-macroexpand-declare-function)
425 (eval-when-compile . (lambda (&rest body) 425 (eval-when-compile . (lambda (&rest body)
426 (list 426 (list
@@ -429,8 +429,19 @@ This list lives partly on the stack.")
429 (byte-compile-top-level 429 (byte-compile-top-level
430 (byte-compile-preprocess (cons 'progn body))))))) 430 (byte-compile-preprocess (cons 'progn body)))))))
431 (eval-and-compile . (lambda (&rest body) 431 (eval-and-compile . (lambda (&rest body)
432 (byte-compile-eval-before-compile (cons 'progn body)) 432 ;; Byte compile before running it. Do it piece by
433 (cons 'progn body)))) 433 ;; piece, in case further expressions need earlier
434 ;; ones to be evaluated already, as is the case in
435 ;; eieio.el.
436 `(progn
437 ,@(mapcar (lambda (exp)
438 (let ((cexp
439 (byte-compile-top-level
440 (byte-compile-preprocess
441 exp))))
442 (eval cexp)
443 cexp))
444 body)))))
434 "The default macro-environment passed to macroexpand by the compiler. 445 "The default macro-environment passed to macroexpand by the compiler.
435Placing a macro here will cause a macro to have different semantics when 446Placing a macro here will cause a macro to have different semantics when
436expanded by the compiler as when expanded by the interpreter.") 447expanded by the compiler as when expanded by the interpreter.")
@@ -731,9 +742,11 @@ otherwise pop it")
731;; Also, this lets us notice references to free variables. 742;; Also, this lets us notice references to free variables.
732 743
733(defmacro byte-compile-push-bytecodes (&rest args) 744(defmacro byte-compile-push-bytecodes (&rest args)
734 "Push BYTE... onto BYTES, and increment PC by the number of bytes pushed. 745 "Push bytes onto BVAR, and increment CVAR by the number of bytes pushed.
735ARGS is of the form (BYTE... BYTES PC), where BYTES and PC are variable names. 746BVAR and CVAR are variables which are updated after evaluating
736BYTES and PC are updated after evaluating all the arguments." 747all the arguments.
748
749\(fn BYTE1 BYTE2 ... BYTEn BVAR CVAR)"
737 (let ((byte-exprs (butlast args 2)) 750 (let ((byte-exprs (butlast args 2))
738 (bytes-var (car (last args 2))) 751 (bytes-var (car (last args 2)))
739 (pc-var (car (last args)))) 752 (pc-var (car (last args))))
@@ -1097,8 +1110,7 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
1097(defun byte-compile-log-warning (string &optional fill level) 1110(defun byte-compile-log-warning (string &optional fill level)
1098 (let ((warning-prefix-function 'byte-compile-warning-prefix) 1111 (let ((warning-prefix-function 'byte-compile-warning-prefix)
1099 (warning-type-format "") 1112 (warning-type-format "")
1100 (warning-fill-prefix (if fill " ")) 1113 (warning-fill-prefix (if fill " ")))
1101 (inhibit-read-only t))
1102 (display-warning 'bytecomp string level byte-compile-log-buffer))) 1114 (display-warning 'bytecomp string level byte-compile-log-buffer)))
1103 1115
1104(defun byte-compile-warn (format &rest args) 1116(defun byte-compile-warn (format &rest args)
@@ -2189,7 +2201,10 @@ list that represents a doc string reference.
2189 (when (and (consp (nth 1 form)) 2201 (when (and (consp (nth 1 form))
2190 (eq (car (nth 1 form)) 'quote) 2202 (eq (car (nth 1 form)) 'quote)
2191 (consp (cdr (nth 1 form))) 2203 (consp (cdr (nth 1 form)))
2192 (symbolp (nth 1 (nth 1 form)))) 2204 (symbolp (nth 1 (nth 1 form)))
2205 ;; Don't add it if it's already defined. Otherwise, it might
2206 ;; hide the actual definition.
2207 (not (fboundp (nth 1 (nth 1 form)))))
2193 (push (cons (nth 1 (nth 1 form)) 2208 (push (cons (nth 1 (nth 1 form))
2194 (cons 'autoload (cdr (cdr form)))) 2209 (cons 'autoload (cdr (cdr form))))
2195 byte-compile-function-environment) 2210 byte-compile-function-environment)
@@ -3689,10 +3704,10 @@ If CONDITION's value is (not (featurep 'emacs)) or (featurep 'xemacs),
3689that suppresses all warnings during execution of BODY." 3704that suppresses all warnings during execution of BODY."
3690 (declare (indent 1) (debug t)) 3705 (declare (indent 1) (debug t))
3691 `(let* ((fbound-list (byte-compile-find-bound-condition 3706 `(let* ((fbound-list (byte-compile-find-bound-condition
3692 ,condition (list 'fboundp) 3707 ,condition '(fboundp functionp)
3693 byte-compile-unresolved-functions)) 3708 byte-compile-unresolved-functions))
3694 (bound-list (byte-compile-find-bound-condition 3709 (bound-list (byte-compile-find-bound-condition
3695 ,condition (list 'boundp 'default-boundp))) 3710 ,condition '(boundp default-boundp)))
3696 ;; Maybe add to the bound list. 3711 ;; Maybe add to the bound list.
3697 (byte-compile-bound-variables 3712 (byte-compile-bound-variables
3698 (append bound-list byte-compile-bound-variables))) 3713 (append bound-list byte-compile-bound-variables)))