From 443c249d85003639512d8d3b6ace184a9ff53bc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= Date: Mon, 27 Feb 2023 13:57:48 +0100 Subject: Warn about `condition-case` without handlers Omitting handlers from a `condition-case` form makes it useless since no errors are caught. * lisp/emacs-lisp/macroexp.el (macroexp--expand-all): New warning. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test--with-suppressed-warnings): Add test case. * etc/NEWS: Announce. --- test/lisp/emacs-lisp/bytecomp-tests.el | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/lisp/emacs-lisp') diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index 185abaf5c22..b6dcfeedb0c 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -1446,6 +1446,12 @@ literals (Bug#20852)." '((suspicious set-buffer)) "Warning: Use .with-current-buffer. rather than") + (test-suppression + '(defun zot (x) + (condition-case nil (list x))) + '((suspicious condition-case)) + "Warning: `condition-case' without handlers") + (test-suppression '(defun zot () (let ((_ 1)) -- cgit v1.2.1