From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eshel Yaron via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#73526: 31.0.50; [FR] warn about unreachable code Date: Sat, 28 Sep 2024 12:23:36 +0200 Message-ID: Reply-To: Eshel Yaron Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20770"; mail-complaints-to="usenet@ciao.gmane.io" To: 73526@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 28 12:24:48 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1suUd5-0005Hp-W7 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 28 Sep 2024 12:24:48 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1suUcs-0003qk-43; Sat, 28 Sep 2024 06:24:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1suUcq-0003qI-9Z for bug-gnu-emacs@gnu.org; Sat, 28 Sep 2024 06:24:32 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1suUcq-0006PN-0r for bug-gnu-emacs@gnu.org; Sat, 28 Sep 2024 06:24:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=j910bKW6IeawWbwWi6N5Nt+wnLLgGEf2OCkszaC4npA=; b=MpxjjaR8xP17gWjH6RbqIiYPFUz+iyjeyl50EWlyvF2l93QlpMmNSdGJoG0OvYwdwN4NunKpi0JBlznXWyyoOF9ZTroHyDDQJpvh0eV790L4iaLdbgjqe22OpBowabg8whyNVkG+cnvYDbMbey8lCCI+RgT+HgcjwAhI2wIXfSLWcFz4l5d+tSMQenAP0RZ27ROXCZRLO0lmFF+U1T37jljjZb2jkPuLytOku4Z3RjcLV9XkNjSRGfZhmqOf11zKsnLx1lbnZPtIiHu2yVft8cJdJYtvyIJpN1pJP1/6ULcClKvW5stiBZ/KlqW/gcMZQCuansVncv5TI6GRQarURg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1suUdJ-0002Va-Na for bug-gnu-emacs@gnu.org; Sat, 28 Sep 2024 06:25:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eshel Yaron Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 28 Sep 2024 10:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 73526 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.17275190579563 (code B ref -1); Sat, 28 Sep 2024 10:25:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 28 Sep 2024 10:24:17 +0000 Original-Received: from localhost ([127.0.0.1]:51912 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1suUca-0002UA-VH for submit@debbugs.gnu.org; Sat, 28 Sep 2024 06:24:17 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:45596) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1suUcZ-0002U3-Su for submit@debbugs.gnu.org; Sat, 28 Sep 2024 06:24:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1suUc5-0003mu-SP for bug-gnu-emacs@gnu.org; Sat, 28 Sep 2024 06:23:45 -0400 Original-Received: from mail.eshelyaron.com ([107.175.124.16] helo=eshelyaron.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1suUc4-0006Ez-Eh for bug-gnu-emacs@gnu.org; Sat, 28 Sep 2024 06:23:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1727519019; bh=qfQzCX/dpsXN8yKHzK4UIsD+nZOv098+f/42Fru9PpA=; h=From:To:Subject:Date:From; b=kfm6W4/GfPtQq0ZIbHT23aD4xTiwQYX4ZC74SDoT5tfEOG2p/LYGAukjAsk3d26dL z1sjiuX/JF+Pw4bbLP7YWABy8+SSO8/gpAAPIfcnAEjdkBBQw5oflJ9X3KxHQfds2A G1Yr/xwC0LD3wwKLYEMesXsri5lT32ITOFXJaN4Jucf0b4E9X5PYQyBoeGme0Gk4JA upjJzFY02HgWPVwt56OTrzjS2ZkD7Kc0vkgKggeFWcSfhZ6+24U6SPt8NlgiuMSKlB OMGVb95bIPC9r753ZwjoM48AnSZ73yDvuR995B6D6uqCJeB1IMW783rZahxUJYVBEt vLQMaY/8yUYdg== Received-SPF: pass client-ip=107.175.124.16; envelope-from=me@eshelyaron.com; helo=eshelyaron.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:292564 Archived-At: Feature request: warn about unreachable code in Emacs Lisp. Unreachable code means Lisp forms that occur in positions that can never be reached, so these forms are never evaluated. The simplest cases of unreachable code are code that is only evaluated after some form that never returns (such no-return forms include signal and throw calls, as well as while loops with a never-nil test). Unreachable code often indicates a programmer mistake, and never improves (or otherwise affects) the program's behavior in any way. So it's helpful to warn about it. Clang and Go provide such warnings, for example. Emacs sources include many occurrences of such unreachable code. For example, in lisp/mail/uudecode.el we find: --8<---------------cut here---------------start------------->8--- (cond (done) ((> 0 remain) (error "uucode line ends unexpectedly") (setq done t)) <---- Unreachable! ...) --8<---------------cut here---------------end--------------->8--- In lisp/gnus/nndir.el we see an example of a clear mistake that produces easily detectable unreachable code: --8<---------------cut here---------------start------------->8--- (or err "No such file or directory: %s" nndir-directory) ^ <---- Unreachable! --8<---------------cut here---------------end--------------->8--- Thanks, Eshel