1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-26 07:33:47 +00:00

Fix obsolete variable warnings about class names

* lisp/emacs-lisp/eieio-core.el (eieio-defclass-autoload): Try to make
the wording of the warning about the obsoleted variable less confusing.
* lisp/emacs-lisp/bytecomp.el (byte-compile-check-variable): Don't
warn for lexical variables (Bug#39169).  Fix spurious `or'.
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp/warn-obsolete-variable-bound\.el): New test.
* test/lisp/emacs-lisp/bytecomp-resources/warn-obsolete-variable-bound.el:
New file.
This commit is contained in:
Michael Heerdegen 2020-12-22 05:44:47 +01:00
parent ba011e487d
commit 96bbbaec5c
4 changed files with 17 additions and 5 deletions

View File

@ -3441,10 +3441,11 @@ for symbols generated by the byte compiler itself."
(and od
(not (memq var byte-compile-not-obsolete-vars))
(not (memq var byte-compile-global-not-obsolete-vars))
(or (pcase (nth 1 od)
(not (memq var byte-compile-lexical-variables))
(pcase (nth 1 od)
('set (not (eq access-type 'reference)))
('get (eq access-type 'reference))
(_ t)))))
(_ t))))
(byte-compile-warn-obsolete var))))
(defsubst byte-compile-dynamic-variable-op (base-op var)

View File

@ -215,7 +215,8 @@ It creates an autoload function for CNAME's constructor."
;; turn this into a usable self-pointing symbol
(when eieio-backward-compatibility
(set cname cname)
(make-obsolete-variable cname (format "use \\='%s instead" cname)
(make-obsolete-variable cname (format "\
use \\='%s or turn off `eieio-backward-compatibility' instead" cname)
"25.1"))
(setf (cl--find-class cname) newc)

View File

@ -0,0 +1,7 @@
;;; -*- lexical-binding: t -*-
(make-obsolete-variable 'bytecomp--tests-obsolete-var-2 nil "99.99")
(defun foo ()
(let ((bytecomp--tests-obsolete-var-2 2))
bytecomp--tests-obsolete-var-2))

View File

@ -625,6 +625,9 @@ Subtests signal errors if something goes wrong."
(bytecomp--define-warning-file-test "warn-obsolete-variable.el"
"bytecomp--tests-obs.*obsolete.*99.99")
(bytecomp--define-warning-file-test "warn-obsolete-variable-bound.el"
"bytecomp--tests-obs.*obsolete.*99.99" t)
(bytecomp--define-warning-file-test "warn-redefine-defun-as-macro.el"
"as both function and macro")