aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/emacs-lisp/bytecomp.el31
1 files changed, 26 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 0e7b9781601..52994e1fbcf 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -532,7 +532,8 @@ This is so we can inline them when necessary.
532Each element looks like (FUNCTIONNAME . DEFINITION). It is 532Each element looks like (FUNCTIONNAME . DEFINITION). It is
533\(FUNCTIONNAME . nil) when a function is redefined as a macro. 533\(FUNCTIONNAME . nil) when a function is redefined as a macro.
534It is \(FUNCTIONNAME . t) when all we know is that it was defined, 534It is \(FUNCTIONNAME . t) when all we know is that it was defined,
535and we don't know the definition.") 535and we don't know the definition. For an autoloaded function, DEFINITION
536has the form (autoload . FILENAME).")
536 537
537(defvar byte-compile-unresolved-functions nil 538(defvar byte-compile-unresolved-functions nil
538 "Alist of undefined functions to which calls have been compiled. 539 "Alist of undefined functions to which calls have been compiled.
@@ -2301,13 +2302,25 @@ list that represents a doc string reference.
2301 (eval (nth 5 form)) ;Macro 2302 (eval (nth 5 form)) ;Macro
2302 (eval form)) ;Define the autoload. 2303 (eval form)) ;Define the autoload.
2303 ;; Avoid undefined function warnings for the autoload. 2304 ;; Avoid undefined function warnings for the autoload.
2304 (if (and (consp (nth 1 form)) 2305 (when (and (consp (nth 1 form))
2305 (eq (car (nth 1 form)) 'quote) 2306 (eq (car (nth 1 form)) 'quote)
2306 (consp (cdr (nth 1 form))) 2307 (consp (cdr (nth 1 form)))
2307 (symbolp (nth 1 (nth 1 form)))) 2308 (symbolp (nth 1 (nth 1 form))))
2308 (push (cons (nth 1 (nth 1 form)) 2309 (push (cons (nth 1 (nth 1 form))
2309 (cons 'autoload (cdr (cdr form)))) 2310 (cons 'autoload (cdr (cdr form))))
2310 byte-compile-function-environment)) 2311 byte-compile-function-environment)
2312 ;; If an autoload occurs _before_ the first call to a function,
2313 ;; byte-compile-callargs-warn does not add an entry to
2314 ;; byte-compile-unresolved-functions. Here we mimic the logic
2315 ;; of byte-compile-callargs-warn so as not to warn if the
2316 ;; autoload comes _after_ the function call.
2317 ;; Alternatively, similar logic could go in
2318 ;; byte-compile-warn-about-unresolved-functions.
2319 (or (memq (nth 1 (nth 1 form)) byte-compile-noruntime-functions)
2320 (setq byte-compile-unresolved-functions
2321 (delq (assq (nth 1 (nth 1 form))
2322 byte-compile-unresolved-functions)
2323 byte-compile-unresolved-functions))))
2311 (if (stringp (nth 3 form)) 2324 (if (stringp (nth 3 form))
2312 form 2325 form
2313 ;; No doc string, so we can compile this as a normal form. 2326 ;; No doc string, so we can compile this as a normal form.
@@ -2387,6 +2400,14 @@ list that represents a doc string reference.
2387 ;; Return nil so the forms are not output twice. 2400 ;; Return nil so the forms are not output twice.
2388 nil) 2401 nil)
2389 2402
2403(put 'with-no-warnings 'byte-hunk-handler
2404 'byte-compile-file-form-with-no-warnings)
2405(defun byte-compile-file-form-with-no-warnings (form)
2406 ;; cf byte-compile-file-form-progn.
2407 (let (byte-compile-warnings)
2408 (mapc 'byte-compile-file-form (cdr form))
2409 nil))
2410
2390;; This handler is not necessary, but it makes the output from dont-compile 2411;; This handler is not necessary, but it makes the output from dont-compile
2391;; and similar macros cleaner. 2412;; and similar macros cleaner.
2392(put 'eval 'byte-hunk-handler 'byte-compile-file-form-eval) 2413(put 'eval 'byte-hunk-handler 'byte-compile-file-form-eval)