summaryrefslogtreecommitdiff
path: root/lisp/subr.el
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2023-05-01 15:55:32 +0200
committerMattias EngdegÄrd <mattiase@acm.org>2023-05-01 17:11:50 +0200
commit7acb3f1c060872b1802e7548d991ca8a9f0fef01 (patch)
tree3f40fc40d805a84daac37748ade991485de284c8 /lisp/subr.el
parentaa56253407eaa62fdfbc037d5b5a6b3c41e6796e (diff)
downloademacs-7acb3f1c060872b1802e7548d991ca8a9f0fef01.tar.gz
Add the function declaration and property `important-return-value`
Now the declaration (declare (important-return-value t)) can be used to have the byte-compiler warn when the return value from a call is discarded (bug#61730). * lisp/emacs-lisp/bytecomp.el (byte-compile-form) (important-return-value-fns): Use the function property `important-return-value` instead of looking through a static list. * lisp/emacs-lisp/byte-run.el (byte-run--set-important-return-value) (defun-declarations-alist): New function declaration, setting the property of the same name. * lisp/emacs-lisp/cl-macs.el: * lisp/subr.el (assoc-default): Set the property. * doc/lispref/functions.texi (Declare Form): * doc/lispref/symbols.texi (Standard Properties): Document. * etc/NEWS: Announce.
Diffstat (limited to 'lisp/subr.el')
-rw-r--r--lisp/subr.el1
1 files changed, 1 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index 427014cedc3..1452a1117d3 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -862,6 +862,7 @@ If that is non-nil, the element matches; then `assoc-default'
If no element matches, the value is nil.
If TEST is omitted or nil, `equal' is used."
+ (declare (important-return-value t))
(let (found (tail alist) value)
(while (and tail (not found))
(let ((elt (car tail)))