diff options
| author | Stefan Monnier | 2021-03-11 13:01:59 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2021-03-11 13:01:59 -0500 |
| commit | e13c30132a81ca2087f7d1a3adc5f6feab84ea2e (patch) | |
| tree | 4083dbc62a386c2918357bbe69e59020d077ad20 | |
| parent | 27b8638409138a02577d2dd43e4cb59540f9174f (diff) | |
| download | emacs-e13c30132a81ca2087f7d1a3adc5f6feab84ea2e.tar.gz 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.
| -rw-r--r-- | lisp/emacs-lisp/cconv.el | 13 |
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." | |||
| 585 | 585 | ||
| 586 | (_ (or (cdr (assq form env)) form)))) | 586 | (_ (or (cdr (assq form env)) form)))) |
| 587 | 587 | ||
| 588 | (unless (fboundp 'byte-compile-not-lexical-var-p) | ||
| 589 | ;; Only used to test the code in non-lexbind Emacs. | ||
| 590 | (defalias 'byte-compile-not-lexical-var-p 'boundp)) | ||
| 591 | (defvar byte-compile-lexical-variables) | 588 | (defvar byte-compile-lexical-variables) |
| 592 | 589 | ||
| 593 | (defun cconv--analyze-use (vardata form varkind) | 590 | (defun cconv--analyze-use (vardata form varkind) |
| @@ -603,7 +600,13 @@ FORM is the parent form that binds this var." | |||
| 603 | ;; FIXME: Convert this warning to use `macroexp--warn-wrap' | 600 | ;; FIXME: Convert this warning to use `macroexp--warn-wrap' |
| 604 | ;; so as to give better position information. | 601 | ;; so as to give better position information. |
| 605 | (byte-compile-warn | 602 | (byte-compile-warn |
| 606 | "%s `%S' not left unused" varkind var))) | 603 | "%s `%S' not left unused" varkind var)) |
| 604 | ((and (let (or 'let* 'let) (car form)) | ||
| 605 | `(,(or `(,var) `(,var nil)) t nil ,_ ,_)) | ||
| 606 | ;; FIXME: Convert this warning to use `macroexp--warn-wrap' | ||
| 607 | ;; so as to give better position information. | ||
| 608 | (unless (not (intern-soft var)) | ||
| 609 | (byte-compile-warn "Variable `%S' left uninitialized" var)))) | ||
| 607 | (pcase vardata | 610 | (pcase vardata |
| 608 | (`(,binder nil ,_ ,_ nil) | 611 | (`(,binder nil ,_ ,_ nil) |
| 609 | (push (cons (cons binder form) :unused) cconv-var-classification)) | 612 | (push (cons (cons binder form) :unused) cconv-var-classification)) |
| @@ -784,7 +787,7 @@ This function does not return anything but instead fills the | |||
| 784 | (let ((dv (assq form env))) ; dv = declared and visible | 787 | (let ((dv (assq form env))) ; dv = declared and visible |
| 785 | (when dv | 788 | (when dv |
| 786 | (setf (nth 1 dv) t)))))) | 789 | (setf (nth 1 dv) t)))))) |
| 787 | (define-obsolete-function-alias 'cconv-analyse-form 'cconv-analyze-form "25.1") | 790 | (define-obsolete-function-alias 'cconv-analyse-form #'cconv-analyze-form "25.1") |
| 788 | 791 | ||
| 789 | (provide 'cconv) | 792 | (provide 'cconv) |
| 790 | ;;; cconv.el ends here | 793 | ;;; cconv.el ends here |