]> git.eshelyaron.com Git - emacs.git/commit
Add empty-body warning for when, unless etc
authorMattias Engdegård <mattiase@acm.org>
Thu, 29 Dec 2022 12:01:47 +0000 (13:01 +0100)
committerMattias Engdegård <mattiase@acm.org>
Thu, 29 Dec 2022 12:01:47 +0000 (13:01 +0100)
commit7c63b632e4e2241a28f08015cc981a72e18d7867
tree10d0f34d06683a03d5603530afd3e93f91f19834
parent2de25accaf31aef643557ec476041c770fc7ac15
Add empty-body warning for when, unless etc

Warn about code like (when SOME-CONDITION) because these may indicate
bugs.  Warnings currently apply to `when`, `unless`, `ignore-error`,
`with-suppressed-warnings` and (as before) `let` and `let*`.

* lisp/emacs-lisp/byte-run.el (with-suppressed-warnings):
Update doc string.
* lisp/emacs-lisp/bytecomp.el: (byte-compile-warning-types)
(byte-compile-warnings): Add empty-body.
(byte-compile-initial-macro-environment):
Add empty-body warning for with-suppressed-warnings.
* lisp/emacs-lisp/macroexp.el (macroexp--expand-all):
Use the empty-body category for let and let*.
* lisp/subr.el (when, unless, ignore-error): Add empty-body warning.
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-test--with-suppressed-warnings): Add test cases.
lisp/emacs-lisp/byte-run.el
lisp/emacs-lisp/bytecomp.el
lisp/emacs-lisp/macroexp.el
lisp/subr.el
test/lisp/emacs-lisp/bytecomp-tests.el