summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/bytecomp.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2022-01-31 16:25:09 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2022-01-31 16:25:09 -0500
commitcce477cad7ffffbfc1a21e9dd711b32f8e2b3ea3 (patch)
tree4b6f9a3e574ac4b875f191dd6b09d27e3e176da3 /lisp/emacs-lisp/bytecomp.el
parentbe2566eeab627dd8c38cfb3adb678a925af300bc (diff)
downloademacs-cce477cad7ffffbfc1a21e9dd711b32f8e2b3ea3.tar.gz
emacs-cce477cad7ffffbfc1a21e9dd711b32f8e2b3ea3.tar.bz2
emacs-cce477cad7ffffbfc1a21e9dd711b32f8e2b3ea3.zip
(byte-compile-eval): Adjust to changes in `load-history`
The `function-history` patch introduced a regression which caused spurious compiler warnings. Fix it. The new code also fixes a bug in the old code, thus causing some new non-spurious warnings. Fix them as well. * lisp/emacs-lisp/bytecomp.el (byte-compile-eval): Adjust to changes in `load-history`. * lisp/gnus/gnus-group.el (nnrss-discover-feed) (nnrss-save-server-data): Use `declare-function`. * lisp/cedet/semantic/wisent/comp.el (wisent-defcontext) (wisent-with-context): * lisp/emacs-lisp/comp.el (comp-op-case): Silence compiler warning.
Diffstat (limited to 'lisp/emacs-lisp/bytecomp.el')
-rw-r--r--lisp/emacs-lisp/bytecomp.el29
1 files changed, 11 insertions, 18 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 2f4bf663438..9c664ff8fed 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1031,30 +1031,23 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
(hist-nil-orig current-load-list))
(prog1 (eval form lexical-binding)
(when (byte-compile-warning-enabled-p 'noruntime)
- (let ((hist-new load-history)
- (hist-nil-new current-load-list))
+ (let* ((hist-new
+ ;; Get new `current-load-list' for the locally defined funs.
+ (cons (butlast current-load-list
+ (length hist-nil-orig))
+ load-history)))
;; Go through load-history, look for newly loaded files
;; and mark all the functions defined therein.
(while (and hist-new (not (eq hist-new hist-orig)))
- (let ((xs (pop hist-new))
- old-autoloads)
+ (let ((xs (pop hist-new)))
;; Make sure the file was not already loaded before.
(unless (assoc (car xs) hist-orig)
(dolist (s xs)
- (cond
- ((and (consp s) (eq t (car s)))
- (push (cdr s) old-autoloads))
- ((and (consp s) (memq (car s) '(autoload defun)))
- (unless (memq (cdr s) old-autoloads)
- (push (cdr s) byte-compile-noruntime-functions))))))))
- ;; Go through current-load-list for the locally defined funs.
- (let (old-autoloads)
- (while (and hist-nil-new (not (eq hist-nil-new hist-nil-orig)))
- (let ((s (pop hist-nil-new)))
- (when (and (symbolp s) (not (memq s old-autoloads)))
- (push s byte-compile-noruntime-functions))
- (when (and (consp s) (eq t (car s)))
- (push (cdr s) old-autoloads))))))))))
+ (pcase s
+ (`(defun . ,f)
+ (unless (seq-some #'autoloadp
+ (get (cdr s) 'function-history))
+ (push f byte-compile-noruntime-functions)))))))))))))
(defun byte-compile-eval-before-compile (form)
"Evaluate FORM for `eval-and-compile'."