]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow inhibiting `not-unused' warnings
authorLars Ingebrigtsen <larsi@gnus.org>
Wed, 13 Oct 2021 17:00:25 +0000 (19:00 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 13 Oct 2021 17:00:31 +0000 (19:00 +0200)
* lisp/emacs-lisp/bytecomp.el (byte-compile-warning-types): Allow
inhibiting the `not-unused' warning (bug#31641).  (There has been
some discussion about removing the `not-unused' warning, but it's
still in there, so making it possible to inhibit it seems like the
right thing to do.)
* lisp/emacs-lisp/cconv.el (cconv--analyze-use): Don't warn about
`not-unused'.

lisp/emacs-lisp/bytecomp.el
lisp/emacs-lisp/cconv.el

index 3f050d1b7997fc228d34188bd0480542c160ed2a..471a0b623adb30ddce793bf813d0c5dafb144019 100644 (file)
@@ -299,7 +299,7 @@ The information is logged to `byte-compile-log-buffer'."
   '(redefine callargs free-vars unresolved
              obsolete noruntime interactive-only
              make-local mapcar constants suspicious lexical lexical-dynamic
-             docstrings)
+             docstrings not-unused)
   "The list of warning types used when `byte-compile-warnings' is t.")
 (defcustom byte-compile-warnings t
   "List of warnings that the byte-compiler should issue (t for all).
@@ -321,6 +321,7 @@ Elements of the list may be:
               lexically bound variable declared dynamic elsewhere
   make-local  calls to `make-variable-buffer-local' that may be incorrect.
   mapcar      mapcar called for effect.
+  not-unused  warning about using variables with symbol names starting with _.
   constants   let-binding of, or assignment to, constants/nonvariables.
   docstrings  docstrings that are too wide (longer than
               `byte-compile-docstring-max-column' or
index 0a6b04b4c1f332fe5b5ace0b57221be623e18013..03e109f25089b7be08f2ec118ad15916972af864 100644 (file)
@@ -608,10 +608,9 @@ FORM is the parent form that binds this var."
     (`((,(and var (guard (eq ?_ (aref (symbol-name var) 0)))) . ,_)
        ,_ ,_ ,_ ,_)
      ;; FIXME: Convert this warning to use `macroexp--warn-wrap'
-     ;; so as to give better position information and obey
-     ;; `byte-compile-warnings'.
-     (byte-compile-warn
-      "%s `%S' not left unused" varkind var))
+     ;; so as to give better position information.
+     (when (byte-compile-warning-enabled-p 'not-unused var)
+       (byte-compile-warn "%s `%S' not left unused" varkind var)))
     ((and (let (or 'let* 'let) (car form))
           `((,var) ;; (or `(,var nil) : Too many false positives: bug#47080
             t nil ,_ ,_))