summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/cconv.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2021-03-11 13:01:59 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2021-03-11 13:01:59 -0500
commite13c30132a81ca2087f7d1a3adc5f6feab84ea2e (patch)
tree4083dbc62a386c2918357bbe69e59020d077ad20 /lisp/emacs-lisp/cconv.el
parent27b8638409138a02577d2dd43e4cb59540f9174f (diff)
downloademacs-e13c30132a81ca2087f7d1a3adc5f6feab84ea2e.tar.gz
emacs-e13c30132a81ca2087f7d1a3adc5f6feab84ea2e.tar.bz2
emacs-e13c30132a81ca2087f7d1a3adc5f6feab84ea2e.zip
* lisp/emacs-lisp/cconv.el (cconv--analyze-use): Warn never-initialized vars
(byte-compile-not-lexical-var-p): Remove Emacs<24 compatibility.
Diffstat (limited to 'lisp/emacs-lisp/cconv.el')
-rw-r--r--lisp/emacs-lisp/cconv.el13
1 files changed, 8 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el
index 68e930fa3f5..ca641a2ef0c 100644
--- a/lisp/emacs-lisp/cconv.el
+++ b/lisp/emacs-lisp/cconv.el
@@ -585,9 +585,6 @@ places where they originally did not directly appear."
(_ (or (cdr (assq form env)) form))))
-(unless (fboundp 'byte-compile-not-lexical-var-p)
- ;; Only used to test the code in non-lexbind Emacs.
- (defalias 'byte-compile-not-lexical-var-p 'boundp))
(defvar byte-compile-lexical-variables)
(defun cconv--analyze-use (vardata form varkind)
@@ -603,7 +600,13 @@ FORM is the parent form that binds this var."
;; FIXME: Convert this warning to use `macroexp--warn-wrap'
;; so as to give better position information.
(byte-compile-warn
- "%s `%S' not left unused" varkind var)))
+ "%s `%S' not left unused" varkind var))
+ ((and (let (or 'let* 'let) (car form))
+ `(,(or `(,var) `(,var nil)) t nil ,_ ,_))
+ ;; FIXME: Convert this warning to use `macroexp--warn-wrap'
+ ;; so as to give better position information.
+ (unless (not (intern-soft var))
+ (byte-compile-warn "Variable `%S' left uninitialized" var))))
(pcase vardata
(`(,binder nil ,_ ,_ nil)
(push (cons (cons binder form) :unused) cconv-var-classification))
@@ -784,7 +787,7 @@ This function does not return anything but instead fills the
(let ((dv (assq form env))) ; dv = declared and visible
(when dv
(setf (nth 1 dv) t))))))
-(define-obsolete-function-alias 'cconv-analyse-form 'cconv-analyze-form "25.1")
+(define-obsolete-function-alias 'cconv-analyse-form #'cconv-analyze-form "25.1")
(provide 'cconv)
;;; cconv.el ends here