emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 5f38dcd43d7 3/3: More accurate suppression of ignored return valu


From: Mattias Engdegård
Subject: master 5f38dcd43d7 3/3: More accurate suppression of ignored return value warning
Date: Fri, 24 Feb 2023 10:54:19 -0500 (EST)

branch: master
commit 5f38dcd43d75bcc71a9d94713aa4bfb99abee61b
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>

    More accurate suppression of ignored return value warning
    
    * 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 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index b0c9667dc19..095468ad978 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]