[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 251dea6 1/7: * lisp/emacs-lisp/bytecomp.el: Warn about unprefixed
From: |
Stefan Monnier |
Subject: |
master 251dea6 1/7: * lisp/emacs-lisp/bytecomp.el: Warn about unprefixed vars in `boundp` |
Date: |
Sun, 7 Mar 2021 19:07:34 -0500 (EST) |
branch: master
commit 251dea693a4e5d1c33257ab3402734a8067049ec
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
* lisp/emacs-lisp/bytecomp.el: Warn about unprefixed vars in `boundp`
(byte-compile--check-prefixed-var): New fun,
extracted from `byte-compile--declare-var`.
(byte-compile--declare-var): Use it.
(byte-compile-maybe-guarded): Use it as well.
---
lisp/emacs-lisp/bytecomp.el | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 4e00fe6..74eb5b0 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -2497,12 +2497,14 @@ list that represents a doc string reference.
(put 'defvar 'byte-hunk-handler 'byte-compile-file-form-defvar)
(put 'defconst 'byte-hunk-handler 'byte-compile-file-form-defvar)
-(defun byte-compile--declare-var (sym)
+(defun byte-compile--check-prefixed-var (sym)
(when (and (symbolp sym)
(not (string-match "[-*/:$]" (symbol-name sym)))
(byte-compile-warning-enabled-p 'lexical sym))
- (byte-compile-warn "global/dynamic var `%s' lacks a prefix"
- sym))
+ (byte-compile-warn "global/dynamic var `%s' lacks a prefix" sym)))
+
+(defun byte-compile--declare-var (sym)
+ (byte-compile--check-prefixed-var sym)
(when (memq sym byte-compile-lexical-variables)
(setq byte-compile-lexical-variables
(delq sym byte-compile-lexical-variables))
@@ -4184,9 +4186,15 @@ that suppresses all warnings during execution of BODY."
byte-compile-unresolved-functions))
(bound-list (byte-compile-find-bound-condition
,condition '(boundp default-boundp local-variable-p)))
+ (new-bound-list
+ ;; (seq-difference byte-compile-bound-variables))
+ (delq nil (mapcar (lambda (s)
+ (if (memq s byte-compile-bound-variables) nil
s))
+ bound-list)))
;; Maybe add to the bound list.
(byte-compile-bound-variables
- (append bound-list byte-compile-bound-variables)))
+ (append new-bound-list byte-compile-bound-variables)))
+ (mapc #'byte-compile--check-prefixed-var new-bound-list)
(unwind-protect
;; If things not being bound at all is ok, so must them being
;; obsolete. Note that we add to the existing lists since Tramp
- master updated (c63d2ef -> 7e1cfa2), Stefan Monnier, 2021/03/07
- master c4f49d7 3/7: * lisp/skeleton.el (skeleton-read): Silence compiler warning, Stefan Monnier, 2021/03/07
- master 26bfd0c 2/7: * lisp/cedet/semantic/bovine.el: Fix recent regression, Stefan Monnier, 2021/03/07
- master 251dea6 1/7: * lisp/emacs-lisp/bytecomp.el: Warn about unprefixed vars in `boundp`,
Stefan Monnier <=
- master 42751f4 4/7: * lisp/cedet/semantic/fw.el (semantic-find-file-noselect): Fix warning, Stefan Monnier, 2021/03/07
- master 490f830 6/7: * lisp/net/ange-ftp.el: Fix problem pointed out by compiler warning, Stefan Monnier, 2021/03/07
- master fb779e9 5/7: * lisp/erc/erc.el: Fix problem pointed out by compiler warning, Stefan Monnier, 2021/03/07
- master 7e1cfa2 7/7: * lisp/net/tramp-cache.el: Fix misuse of bound-and-true-p, Stefan Monnier, 2021/03/07