From unknown Tue Jun 24 03:26:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14883: warning about unused returned value from some ert shoulds Resent-From: Glenn Morris Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 16 Jul 2013 20:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 14883 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 14883@debbugs.gnu.org X-Debbugs-Original-To: submit@debbugs.gnu.org Received: via spool by submit@debbugs.gnu.org id=B.137400582920566 (code B ref -1); Tue, 16 Jul 2013 20:18:01 +0000 Received: (at submit) by debbugs.gnu.org; 16 Jul 2013 20:17:09 +0000 Received: from localhost ([127.0.0.1]:59092 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UzBgL-0005LZ-Bo for submit@debbugs.gnu.org; Tue, 16 Jul 2013 16:17:09 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:59726 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UzBgJ-0005LL-5H for submit@debbugs.gnu.org; Tue, 16 Jul 2013 16:17:07 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1UzBgI-0007B7-1o; Tue, 16 Jul 2013 16:17:06 -0400 From: Glenn Morris X-Spook: SCUD missile ARPA Bruxelles cryptographic Area 51 X-Ran: Mu|v`ku/7}DXV:|V=4TE7P"gZf9;tO|=RU[=,~LEM&LVt5,-$d\Rnt9CGMi6*R{rA^Zebf X-Hue: red X-Attribution: GM Date: Tue, 16 Jul 2013 16:17:05 -0400 Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -5.4 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.4 (-----) Package: emacs Version: 24.3 Severity: minor Compiling a file with contents: ;; -*- lexical-binding: t; -*- (require 'ert) (require 'cl-lib) (defvar foo-test 1) (should foo-test) (cl-assert foo-test) results in a warning (for some reason, only when lexical-binding is t): foo.el:5:1:Warning: value returned from (car value-94600) is unused The warning is from the `should'. Obviously it is a bogus warning because the whole point of the should is to test the return value. The similar cl-assert does not trigger a warning, because internally cl-assert is written differently. This is the same issue as http://debbugs.gnu.org/10969, for what is now cl-pop. byte-optimize-form-code-walker has special handling for the standard `pop' macro so as not to warn about unused return values from (pop foo). It would be nice if there was a general way to get the same result for arbitrary macros (sort of the opposite of side-effect-free?), but I don't see how. From unknown Tue Jun 24 03:26:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14883: warning about unused returned value from some ert shoulds Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 22 Jul 2013 15:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14883 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Glenn Morris Cc: 14883@debbugs.gnu.org Received: via spool by 14883-submit@debbugs.gnu.org id=B14883.13745072996171 (code B ref 14883); Mon, 22 Jul 2013 15:35:01 +0000 Received: (at 14883) by debbugs.gnu.org; 22 Jul 2013 15:34:59 +0000 Received: from localhost ([127.0.0.1]:42832 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V1I8Y-0001bP-Rh for submit@debbugs.gnu.org; Mon, 22 Jul 2013 11:34:59 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:23357) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V1I8W-0001b6-97 for 14883@debbugs.gnu.org; Mon, 22 Jul 2013 11:34:56 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFG4rw7r/2dsb2JhbAA7Cb8OF3OCHgEBBAFWIwULCw4mEhQYDSSIHgbBLY0Wg3QDlymKIIMxgV6DEw X-IPAS-Result: Av4EABK/CFG4rw7r/2dsb2JhbAA7Cb8OF3OCHgEBBAFWIwULCw4mEhQYDSSIHgbBLY0Wg3QDlymKIIMxgV6DEw X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="19526932" Received: from 184-175-14-235.dsl.teksavvy.com (HELO pastel.home) ([184.175.14.235]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 22 Jul 2013 11:34:44 -0400 Received: by pastel.home (Postfix, from userid 20848) id 0B6986D694; Mon, 22 Jul 2013 11:34:50 -0400 (EDT) From: Stefan Monnier Message-ID: References: Date: Mon, 22 Jul 2013 11:34:49 -0400 In-Reply-To: (Glenn Morris's message of "Tue, 16 Jul 2013 16:17:05 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > This is the same issue as http://debbugs.gnu.org/10969, for what is now > cl-pop. There's no `cl-pop'. Instead `pop' is now always like CL's `pop'. > byte-optimize-form-code-walker has special handling for the standard > `pop' macro so as not to warn about unused return values from (pop foo). > It would be nice if there was a general way to get the same result for > arbitrary macros (sort of the opposite of side-effect-free?), but I > don't see how. I think the way to do it is to introduce a new function (call it `ignorable') which works like `identity' and then make pop use it around the code that returns the value. Then byte-optimize-form-code-walker can be modified to recognize this function and just throw away the whole call when `for-effect' is nil. We can then get rid of this ad-hoc handling of `pop'. Stefan From unknown Tue Jun 24 03:26:33 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Glenn Morris Subject: bug#14883: closed (Re: bug#14883: warning about unused returned value from some ert shoulds) Message-ID: References: X-Gnu-PR-Message: they-closed 14883 X-Gnu-PR-Package: emacs Reply-To: 14883@debbugs.gnu.org Date: Thu, 05 Sep 2013 03:07:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1378350422-31754-1" This is a multi-part message in MIME format... ------------=_1378350422-31754-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #14883: warning about unused returned value from some ert shoulds which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 14883@debbugs.gnu.org. --=20 14883: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D14883 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1378350422-31754-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 14883-done) by debbugs.gnu.org; 5 Sep 2013 03:06:54 +0000 Received: from localhost ([127.0.0.1]:40944 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VHPuH-0008Fk-Mi for submit@debbugs.gnu.org; Wed, 04 Sep 2013 23:06:54 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:20974) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VHPuE-0008FT-VY for 14883-done@debbugs.gnu.org; Wed, 04 Sep 2013 23:06:51 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFHO+KK6/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDpHqBXoMT X-IPAS-Result: Av4EABK/CFHO+KK6/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDpHqBXoMT X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="26499747" Received: from 206-248-162-186.dsl.teksavvy.com (HELO ceviche.home) ([206.248.162.186]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 04 Sep 2013 23:03:38 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 9DA3F660A1; Wed, 4 Sep 2013 23:06:38 -0400 (EDT) From: Stefan Monnier To: Glenn Morris Subject: Re: bug#14883: warning about unused returned value from some ert shoulds Message-ID: References: Date: Wed, 04 Sep 2013 23:06:38 -0400 In-Reply-To: (Glenn Morris's message of "Tue, 16 Jul 2013 16:17:05 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 14883-done Cc: 14883-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > Compiling a file with contents: > ;; -*- lexical-binding: t; -*- > (require 'ert) > (require 'cl-lib) > (defvar foo-test 1) > (should foo-test) > (cl-assert foo-test) > results in a warning (for some reason, only when lexical-binding is t): > foo.el:5:1:Warning: value returned from (car value-94600) is unused This `car' came from the closure conversion. I believe it is now fixed in the trunk. Thank you. Stefan ------------=_1378350422-31754-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 16 Jul 2013 20:17:09 +0000 Received: from localhost ([127.0.0.1]:59092 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UzBgL-0005LZ-Bo for submit@debbugs.gnu.org; Tue, 16 Jul 2013 16:17:09 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:59726 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UzBgJ-0005LL-5H for submit@debbugs.gnu.org; Tue, 16 Jul 2013 16:17:07 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1UzBgI-0007B7-1o; Tue, 16 Jul 2013 16:17:06 -0400 From: Glenn Morris To: submit@debbugs.gnu.org Subject: warning about unused returned value from some ert shoulds X-Spook: SCUD missile ARPA Bruxelles cryptographic Area 51 X-Ran: Mu|v`ku/7}DXV:|V=4TE7P"gZf9;tO|=RU[=,~LEM&LVt5,-$d\Rnt9CGMi6*R{rA^Zebf X-Hue: red X-Debbugs-No-Ack: yes X-Attribution: GM Date: Tue, 16 Jul 2013 16:17:05 -0400 Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -5.4 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.4 (-----) Package: emacs Version: 24.3 Severity: minor Compiling a file with contents: ;; -*- lexical-binding: t; -*- (require 'ert) (require 'cl-lib) (defvar foo-test 1) (should foo-test) (cl-assert foo-test) results in a warning (for some reason, only when lexical-binding is t): foo.el:5:1:Warning: value returned from (car value-94600) is unused The warning is from the `should'. Obviously it is a bogus warning because the whole point of the should is to test the return value. The similar cl-assert does not trigger a warning, because internally cl-assert is written differently. This is the same issue as http://debbugs.gnu.org/10969, for what is now cl-pop. byte-optimize-form-code-walker has special handling for the standard `pop' macro so as not to warn about unused return values from (pop foo). It would be nice if there was a general way to get the same result for arbitrary macros (sort of the opposite of side-effect-free?), but I don't see how. ------------=_1378350422-31754-1--