summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2023-03-29 13:21:26 +0200
committerMattias EngdegÄrd <mattiase@acm.org>2023-03-29 19:47:03 +0200
commit9c31ee468618c95959454736d939eb46bc52b19b (patch)
treea8ce7a49681f33cb4dabc0e0d60d6bb6a8bd36b9 /etc
parent7177393826c73c87ffe9b428f0e5edae244d7a98 (diff)
downloademacs-9c31ee468618c95959454736d939eb46bc52b19b.tar.gz
Warn about unwind-protect without unwind forms
`unwind-protect` without unwind forms is not just pointless but often indicates a mistake where the intended unwind part is misplaced, as in (unwind-protect (progn PROT-FORMS UNWIND-FORMS)) ; oops or (unwind-protect PROT-FORM) UNWIND-FORMS ; also oops or entirely forgotten for that matter. Warning about this makes sense, and the warning can always be silenced by removing the `unwind-protect` altogether if it shouldn't be there in the first place. * lisp/emacs-lisp/macroexp.el (macroexp--expand-all): Implement warning. * etc/NEWS: Announce. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test--with-suppressed-warnings): Add test case.
Diffstat (limited to 'etc')
-rw-r--r--etc/NEWS15
1 files changed, 15 insertions, 0 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 9e45b1d80b2..f27cafb3d41 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -418,6 +418,21 @@ was to catch all errors, add an explicit handler for 'error', or use
This warning can be suppressed using 'with-suppressed-warnings' with
the warning name 'suspicious'.
+---
+*** Warn about 'unwind-protect' without unwind forms.
+The compiler now warns when the 'unwind-protect' form is used without
+any unwind forms, as in
+
+ (unwind-protect (read buffer))
+
+because the behaviour is identical to that of the argument; there is
+no protection of any kind. Perhaps the intended unwind forms have
+been misplaced or forgotten, or the use of 'unwind-protect' could be
+simplified away.
+
+This warning can be suppressed using 'with-suppressed-warnings' with
+the warning name 'suspicious'.
+
+++
** New function 'file-user-uid'.
This function is like 'user-uid', but is aware of file name handlers,