aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp
diff options
context:
space:
mode:
authorMattias EngdegÄrd2023-04-08 19:17:17 +0200
committerMattias EngdegÄrd2023-04-08 19:34:30 +0200
commitaef996cd34f421da6540cccb9cc3ac2153458e36 (patch)
treec2e20adfef2ebbdeb9f0854f9eee2dd21596708a /test/lisp
parent10b58633b566cf8f66f12e2126da3b43cd09dfc8 (diff)
downloademacs-aef996cd34f421da6540cccb9cc3ac2153458e36.tar.gz
emacs-aef996cd34f421da6540cccb9cc3ac2153458e36.zip
Consolidate existing warnings about unused return values
Move the warning about unused return values from calls to side-effect-free functions from the source-level optimiser to the code generator, where it can be unified with the special-purpose warning about unused values from `mapcar`. This change also cures spurious duplicate warnings about the same code, makes the warnings amenable to suppression through `with-suppressed-warnings`, and now warns about some unused values that weren't caught before. * lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Move warning away from here. * lisp/emacs-lisp/byte-run.el (with-suppressed-warnings): * lisp/emacs-lisp/bytecomp.el (byte-compile-warnings): Doc string updates. (byte-compile-form): Put the new warnings here. (byte-compile-normal-call): Move mapcar warning away from here. * lisp/emacs-lisp/bytecomp.el (byte-compile-ignore): Compile args to `ignore` for value to avoid unused-value warnings, and then discard the generated values immediately thereafter. Mostly this does not affect the generated code but in rare cases it might result in slightly worse code. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test--with-suppressed-warnings): Adapt test.
Diffstat (limited to 'test/lisp')
-rw-r--r--test/lisp/emacs-lisp/bytecomp-tests.el4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el
index 5bad1ce41a8..9ade47331df 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -1438,8 +1438,8 @@ literals (Bug#20852)."
1438 '(defun zot () 1438 '(defun zot ()
1439 (mapcar #'list '(1 2 3)) 1439 (mapcar #'list '(1 2 3))
1440 nil) 1440 nil)
1441 '((mapcar mapcar)) 1441 '((ignored-return-value mapcar))
1442 "Warning: .mapcar. called for effect") 1442 "Warning: value from call to `mapcar' is unused; use `mapc' or `dolist' instead")
1443 1443
1444 (test-suppression 1444 (test-suppression
1445 '(defun zot () 1445 '(defun zot ()