* lisp/emacs-lisp/bytecomp.el (byte-compile-condition-case):
Add warning.
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-warn-quoted-condition): Add test case.
(dolist (clause (reverse clauses))
(let ((condition (nth 1 clause)))
+ (when (and (eq (car-safe condition) 'quote)
+ (cdr condition) (null (cddr condition)))
+ (byte-compile-warn-x
+ condition "`condition-case' condition should not be quoted: %S"
+ condition))
(unless (consp condition) (setq condition (list condition)))
(dolist (c condition)
(unless (and c (symbolp c))
`(defvar foo t ,bytecomp-tests--docstring)))
(ert-deftest bytecomp-warn-quoted-condition ()
+ (bytecomp--with-warning-test
+ "Warning: `condition-case' condition should not be quoted: 'arith-error"
+ '(condition-case nil
+ (abc)
+ ('arith-error "ugh")))
(bytecomp--with-warning-test
"Warning: `ignore-error' condition argument should not be quoted: 'error"
'(ignore-error 'error (abc))))