mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-23 14:10:28 -08: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:
parent
ba011e487d
commit
96bbbaec5c
4 changed files with 17 additions and 5 deletions
|
|
@ -3441,10 +3441,11 @@ for symbols generated by the byte compiler itself."
|
||||||
(and od
|
(and od
|
||||||
(not (memq var byte-compile-not-obsolete-vars))
|
(not (memq var byte-compile-not-obsolete-vars))
|
||||||
(not (memq var byte-compile-global-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)))
|
('set (not (eq access-type 'reference)))
|
||||||
('get (eq access-type 'reference))
|
('get (eq access-type 'reference))
|
||||||
(_ t)))))
|
(_ t))))
|
||||||
(byte-compile-warn-obsolete var))))
|
(byte-compile-warn-obsolete var))))
|
||||||
|
|
||||||
(defsubst byte-compile-dynamic-variable-op (base-op var)
|
(defsubst byte-compile-dynamic-variable-op (base-op var)
|
||||||
|
|
|
||||||
|
|
@ -215,7 +215,8 @@ It creates an autoload function for CNAME's constructor."
|
||||||
;; turn this into a usable self-pointing symbol
|
;; turn this into a usable self-pointing symbol
|
||||||
(when eieio-backward-compatibility
|
(when eieio-backward-compatibility
|
||||||
(set cname cname)
|
(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"))
|
"25.1"))
|
||||||
|
|
||||||
(setf (cl--find-class cname) newc)
|
(setf (cl--find-class cname) newc)
|
||||||
|
|
|
||||||
|
|
@ -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))
|
||||||
|
|
@ -625,6 +625,9 @@ Subtests signal errors if something goes wrong."
|
||||||
(bytecomp--define-warning-file-test "warn-obsolete-variable.el"
|
(bytecomp--define-warning-file-test "warn-obsolete-variable.el"
|
||||||
"bytecomp--tests-obs.*obsolete.*99.99")
|
"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"
|
(bytecomp--define-warning-file-test "warn-redefine-defun-as-macro.el"
|
||||||
"as both function and macro")
|
"as both function and macro")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue