emacs-devel
[Top][All Lists]
Advanced

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

Re: Towards a cleaner build


From: Lars Ingebrigtsen
Subject: Re: Towards a cleaner build
Date: Fri, 17 May 2019 14:31:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

I had a whack at suppressing warnings about obsolete functions being
called from other obsolete functions, and it seems to work for my test
case.

A very similar case can be added for the advertised calling convention
case, I think (where a function calls itself recursively with the
"wrong" convention).

If we want to go in this direction, I can finish it up and add some
documentation...

diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index e76baf5ed0..893171f4f5 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -337,12 +337,19 @@ byte-compile-warnings
        (or (symbolp v)
            (null (delq nil (mapcar (lambda (x) (not (symbolp x))) v))))))
 
-(defun byte-compile-warning-enabled-p (warning)
+(defun byte-compile-warning-enabled-p (warning &optional symbol)
   "Return non-nil if WARNING is enabled, according to `byte-compile-warnings'."
-  (or (eq byte-compile-warnings t)
-      (if (eq (car byte-compile-warnings) 'not)
-          (not (memq warning byte-compile-warnings))
-        (memq warning byte-compile-warnings))))
+  ;; Don't issue a warning for SYMBOL being obsolete if called from
+  ;; within an obsolete function.
+  (and (not (and (eq warning 'obsolete)
+                 byte-compile-current-form
+                 (eq byte-compile-current-form symbol)
+                 (get byte-compile-current-form 'byte-obsolete-info)
+                 (not (memq symbol byte-compile-not-obsolete-funcs))))
+       (or (eq byte-compile-warnings t)
+           (if (eq (car byte-compile-warnings) 'not)
+               (not (memq warning byte-compile-warnings))
+             (memq warning byte-compile-warnings)))))
 
 ;;;###autoload
 (defun byte-compile-disable-warning (warning)
@@ -1268,7 +1275,7 @@ byte-compile-warn
 
 (defun byte-compile-warn-obsolete (symbol)
   "Warn that SYMBOL (a variable or function) is obsolete."
-  (when (byte-compile-warning-enabled-p 'obsolete)
+  (when (byte-compile-warning-enabled-p 'obsolete symbol)
     (let* ((funcp (get symbol 'byte-obsolete-info))
            (msg (macroexp--obsolete-warning
                  symbol

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




reply via email to

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