]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow inhibiting warnings about unused variables and empty bodies
authorLars Ingebrigtsen <larsi@gnus.org>
Tue, 6 Jul 2021 14:43:49 +0000 (16:43 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 6 Jul 2021 14:43:49 +0000 (16:43 +0200)
* 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
lisp/emacs-lisp/macroexp.el

index f6637109028c44b66e4e682ba20932b71f66a937..f1579cda8bd167c523c857c11e0ec5b401a2d957 100644 (file)
@@ -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
index df864464b77c600776059207374161e4f735ed9e..11387df2147f9598a90e110b0d793de55b0c2700 100644 (file)
@@ -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.