[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 43fba07: Allow inhibiting warnings about unused variables and emp
From: |
Lars Ingebrigtsen |
Subject: |
master 43fba07: Allow inhibiting warnings about unused variables and empty bodies |
Date: |
Tue, 6 Jul 2021 10:44:09 -0400 (EDT) |
branch: master
commit 43fba076c99cb8e62236f636bfc036068a63c166
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Allow inhibiting warnings about unused variables and empty bodies
* lisp/emacs-lisp/cconv.el (cconv--warn-unused-msg): Allow
inhibiting warnings about unbound variables (bug#26486).
* lisp/emacs-lisp/macroexp.el (macroexp--expand-all): Allow
inhibiting warnings about empty bodies.
---
lisp/emacs-lisp/cconv.el | 3 ++-
lisp/emacs-lisp/macroexp.el | 18 ++++++++++--------
2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el
index f663710..f1579cd 100644
--- a/lisp/emacs-lisp/cconv.el
+++ b/lisp/emacs-lisp/cconv.el
@@ -259,7 +259,8 @@ Returns a form where all lambdas don't have any free
variables."
(not (intern-soft var))
(eq ?_ (aref (symbol-name var) 0))
;; As a special exception, ignore "ignore".
- (eq var 'ignored))
+ (eq var 'ignored)
+ (not (byte-compile-warning-enabled-p 'unbound var)))
(let ((suggestions (help-uni-confusable-suggestions (symbol-name var))))
(format "Unused lexical %s `%S'%s"
varkind var
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el
index df86446..11387df 100644
--- a/lisp/emacs-lisp/macroexp.el
+++ b/lisp/emacs-lisp/macroexp.el
@@ -319,14 +319,16 @@ Assumes the caller has bound
`macroexpand-all-environment'."
(`(,(and fun (or 'let 'let*)) . ,(or `(,bindings . ,body)
pcase--dontcare))
(macroexp--cons fun
- (macroexp--cons (macroexp--all-clauses bindings 1)
- (if (null body)
- (macroexp-unprogn
- (macroexp-warn-and-return
- (format "Empty %s body" fun)
- nil t))
- (macroexp--all-forms body))
- (cdr form))
+ (macroexp--cons
+ (macroexp--all-clauses bindings 1)
+ (if (null body)
+ (macroexp-unprogn
+ (macroexp-warn-and-return
+ (and (byte-compile-warning-enabled-p t)
+ (format "Empty %s body" fun))
+ nil t))
+ (macroexp--all-forms body))
+ (cdr form))
form))
(`(,(and fun `(lambda . ,_)) . ,args)
;; Embedded lambda in function position.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 43fba07: Allow inhibiting warnings about unused variables and empty bodies,
Lars Ingebrigtsen <=