From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Unused value of error-free function warning Date: Tue, 09 Apr 2019 16:40:36 -0400 Message-ID: References: <87fu3vdjjk.fsf@tcd.ie> <87bmcqhhsf.fsf@tcd.ie> <87in6xgtpb.fsf@tcd.ie> <2af892df-26cb-60b2-4fd8-067fcb3d32e9@cs.ucla.edu> <87r2kh9uwx.fsf@tcd.ie> <83h8lcnbxb.fsf@gnu.org> <87sh4s9poo.fsf@tcd.ie> <87k1q49p0i.fsf@tcd.ie> <87efgbbq2p.fsf@tcd.ie> <87a7gz8hp2.fsf@tcd.ie> <87mukzb173.fsf@tcd.ie> <87ftqr9c1l.fsf_-_@tcd.ie> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="207043"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: "Basil L. Contovounesios" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 09 22:40:54 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hDxY6-000rku-A7 for ged-emacs-devel@m.gmane.org; Tue, 09 Apr 2019 22:40:54 +0200 Original-Received: from localhost ([127.0.0.1]:48875 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDxY5-0003Bo-7B for ged-emacs-devel@m.gmane.org; Tue, 09 Apr 2019 16:40:53 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:53505) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDxXs-00039K-5d for emacs-devel@gnu.org; Tue, 09 Apr 2019 16:40:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hDxXr-0000tv-9d for emacs-devel@gnu.org; Tue, 09 Apr 2019 16:40:40 -0400 Original-Received: from alt24.smtp-out.videotron.ca ([70.80.0.75]:17506) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hDxXr-0000rG-3N for emacs-devel@gnu.org; Tue, 09 Apr 2019 16:40:39 -0400 Original-Received: from fmsmemgm.homelinux.net ([24.203.163.157]) by Videotron with SMTP id DxXohLLe6HTT3DxXphFyYu; Tue, 09 Apr 2019 16:40:38 -0400 X-Authority-Analysis: v=2.3 cv=ZegzyPdA c=1 sm=1 tr=0 a=271BjrAMcq2W4n6OKK/JJg==:117 a=271BjrAMcq2W4n6OKK/JJg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=oexKYjalfGEA:10 a=9p-gplBDVuta1VwkA8cA:9 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 9EEDCAE2B8; Tue, 9 Apr 2019 16:40:36 -0400 (EDT) In-Reply-To: <87ftqr9c1l.fsf_-_@tcd.ie> (Basil L. Contovounesios's message of "Tue, 09 Apr 2019 21:08:38 +0100") X-CMAE-Envelope: MS4wfDdmpKxQeznurlI2AQ32IMqHwrqaL4ouaSVtGzh5yRzrUYoLeEK6OaMi8zeOcmQdOt2kNdckc/FF2dcZiXT+wh46E0m0Tu7LvL0CJkg1BePEEKgcLKMq XySCuuJHEPPWagpu5ISXzVRiM9mi9QyNlCYvr3kRT1cSjRNxD8l9WgwEKWjsqH4J1IRPpV7UJSHIEMs3YlKv5Voce5d1cnZCm5duK5TIkmKgHBtjTR761RAW spDJnjvYbA4AlQkHRCqlQg== X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 70.80.0.75 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:235179 Archived-At: > (byte-compile '(progn (list) t)) > ;; => t > > with: > > (byte-compile '(progn (+) t)) > ;; => t (Warning: value returned from (+) is unused) IIRC part of the reason is that it's safe to remove (list) so it's a plain and simple optimization and the user may consciously rely on it (e.g., I remember changing some `car` calls to `car-safe` in some macros so as not to get warnings when the result is not used), whereas for (+) it's not guaranteed to be safe (and it's only removed depending on byte-compile-delete-errors). > I understand that dead error-free expressions are just deleted, but > shouldn't the user be warned of this? Warnings are pretty tricky business because you don't want to annoy the user with warnings about perfectly legitimate code. So there's no hard and fast rule and you can't always get it right; instead it's a murky grey area where you try to minimize both the false positives and false negatives. Stefan