]> git.eshelyaron.com Git - emacs.git/commitdiff
More accurate suppression of ignored return value warning
authorMattias Engdegård <mattiase@acm.org>
Fri, 24 Feb 2023 14:32:04 +0000 (15:32 +0100)
committerMattias Engdegård <mattiase@acm.org>
Fri, 24 Feb 2023 15:53:32 +0000 (16:53 +0100)
* lisp/emacs-lisp/bytecomp.el (byte-compile-file-form-defalias):
Be careful to propagate the for-effect mode through a
`with-suppressed-warnings` form when compiling, so that a form
inside isn't erroneously considered to have its value 'used'
by the surrounding warning suppression form itself.

lisp/emacs-lisp/bytecomp.el

index b0c9667dc195d1955703936809b4ba52f25447de..095468ad978f2a04bf1e6f3e9cadc1044d246b37 100644 (file)
@@ -5079,7 +5079,10 @@ binding slots have been popped."
 (defun byte-compile-suppressed-warnings (form)
   (let ((byte-compile--suppressed-warnings
          (append (cadadr form) byte-compile--suppressed-warnings)))
-    (byte-compile-form (macroexp-progn (cddr form)))))
+    ;; Propagate the for-effect mode explicitly so that warnings about
+    ;; ignored return values can be detected and suppressed correctly.
+    (byte-compile-form (macroexp-progn (cddr form)) byte-compile--for-effect)
+    (setq byte-compile--for-effect nil)))
 
 ;; Warn about misuses of make-variable-buffer-local.
 (byte-defop-compiler-1 make-variable-buffer-local