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.
This commit is contained in:
parent
2de25accaf
commit
7c63b632e4
5 changed files with 84 additions and 24 deletions
|
@ -649,8 +649,8 @@ in `byte-compile-warning-types'; see the variable
|
|||
`byte-compile-warnings' for a fuller explanation of the warning
|
||||
types. The types that can be suppressed with this macro are
|
||||
`free-vars', `callargs', `redefine', `obsolete',
|
||||
`interactive-only', `lexical', `mapcar', `constants' and
|
||||
`suspicious'.
|
||||
`interactive-only', `lexical', `mapcar', `constants',
|
||||
`suspicious' and `empty-body'.
|
||||
|
||||
For the `mapcar' case, only the `mapcar' function can be used in
|
||||
the symbol list. For `suspicious', only `set-buffer', `lsh' and `eq'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue