mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-23 22:20:24 -08:00
Add byte-compiler warning about useless trailing cond clauses
Warn about clauses after the default clause, as in
(cond ((= x 0) (say "none"))
(t (say "some"))
(say "goodbye"))
because they are very much an indicator of a mistake (such as
misplaced brackets), and since they are deleted by the optimiser, any
other warnings there are lost and the user wouldn't know that
something is wrong otherwise.
* lisp/emacs-lisp/macroexp.el (macroexp--expand-all): Add warning.
* etc/NEWS: Announce.
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-test--with-suppressed-warnings): Add test case.
This commit is contained in:
parent
176b7dad71
commit
c137b5195b
3 changed files with 52 additions and 1 deletions
|
|
@ -1512,6 +1512,15 @@ literals (Bug#20852)."
|
|||
'((suspicious unwind-protect))
|
||||
"Warning: `unwind-protect' without unwind forms")
|
||||
|
||||
(test-suppression
|
||||
'(defun zot (x)
|
||||
(cond
|
||||
((zerop x) 'zero)
|
||||
(t 'nonzero)
|
||||
(happy puppy)))
|
||||
'((suspicious cond))
|
||||
"Warning: Useless clause following default `cond' clause")
|
||||
|
||||
(test-suppression
|
||||
'(defun zot ()
|
||||
(let ((_ 1))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue