emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master cce477cad7: (byte-compile-eval): Adjust to changes in `load-histo


From: Stefan Monnier
Subject: master cce477cad7: (byte-compile-eval): Adjust to changes in `load-history`
Date: Mon, 31 Jan 2022 16:29:30 -0500 (EST)

branch: master
commit cce477cad7ffffbfc1a21e9dd711b32f8e2b3ea3
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    (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.
---
 lisp/cedet/semantic/wisent/comp.el |  2 ++
 lisp/emacs-lisp/bytecomp.el        | 29 +++++++++++------------------
 lisp/emacs-lisp/comp.el            |  1 +
 lisp/gnus/gnus-group.el            |  6 +++---
 4 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/lisp/cedet/semantic/wisent/comp.el 
b/lisp/cedet/semantic/wisent/comp.el
index f842b3c364..ba67d25060 100644
--- a/lisp/cedet/semantic/wisent/comp.el
+++ b/lisp/cedet/semantic/wisent/comp.el
@@ -65,6 +65,7 @@
 (defmacro wisent-defcontext (name &rest vars)
   "Define a context NAME that will bind variables VARS."
   (declare (indent 1))
+  (declare-function wisent-context-name nil (name))
   (let* ((context (wisent-context-name name))
          (declarations (mapcar (lambda (v) (list 'defvar v)) vars)))
     `(progn
@@ -75,6 +76,7 @@
 (defmacro wisent-with-context (name &rest body)
   "Bind variables in context NAME then eval BODY."
   (declare (indent 1))
+  (declare-function wisent-context-bindings nil (name))
   `(dlet ,(wisent-context-bindings name)
      ,@body))
 
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 2f4bf66343..9c664ff8fe 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'."
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index a23169aa0f..9c2fc93821 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -1767,6 +1767,7 @@ This is responsible for generating the proper stack 
adjustment, when known,
 and the annotation emission."
   (declare (debug (body))
            (indent defun))
+  (declare-function comp-body-eff nil (body op-name sp-delta))
   `(pcase op
      ,@(cl-loop for (op . body) in cases
                for sp-delta = (gethash op comp-op-stack-info)
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index d3a94e9f4e..8937df2601 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -3135,9 +3135,9 @@ If SOLID (the prefix), create a solid group."
             (if (derived-mode-p 'gnus-summary-mode) 'summary 'group))))))
 
 (defvar nnrss-group-alist)
-(eval-when-compile
-  (defun nnrss-discover-feed (_arg))
-  (defun nnrss-save-server-data (_arg)))
+(declare-function nnrss-discover-feed "nnrss" (url))
+(declare-function nnrss-save-server-data "nnrss" (server))
+
 (defun gnus-group-make-rss-group (&optional url)
   "Given a URL, discover if there is an RSS feed.
 If there is, use Gnus to create an nnrss group"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]