diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2022-12-29 13:01:47 +0100 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2022-12-29 13:01:47 +0100 |
commit | 7c63b632e4e2241a28f08015cc981a72e18d7867 (patch) | |
tree | 10d0f34d06683a03d5603530afd3e93f91f19834 /lisp/emacs-lisp/macroexp.el | |
parent | 2de25accaf31aef643557ec476041c770fc7ac15 (diff) | |
download | emacs-7c63b632e4e2241a28f08015cc981a72e18d7867.tar.gz emacs-7c63b632e4e2241a28f08015cc981a72e18d7867.tar.bz2 emacs-7c63b632e4e2241a28f08015cc981a72e18d7867.zip |
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.
Diffstat (limited to 'lisp/emacs-lisp/macroexp.el')
-rw-r--r-- | lisp/emacs-lisp/macroexp.el | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el index 8953e5fd019..8aa9cb860c4 100644 --- a/lisp/emacs-lisp/macroexp.el +++ b/lisp/emacs-lisp/macroexp.el @@ -368,7 +368,7 @@ Assumes the caller has bound `macroexpand-all-environment'." (macroexp-unprogn (macroexp-warn-and-return (format "Empty %s body" fun) - nil nil 'compile-only fun)) + nil (list 'empty-body fun) 'compile-only fun)) (macroexp--all-forms body)) (cdr form)) form))) |