Stefan Kangas <stefankangas@HIDDEN>
to control <at> debbugs.gnu.org.
Full text available.
Received: (at submit) by debbugs.gnu.org; 28 Sep 2024 10:24:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 28 06:24:17 2024
Received: from localhost ([127.0.0.1]:51912 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1suUca-0002UA-VH
for submit <at> debbugs.gnu.org; Sat, 28 Sep 2024 06:24:17 -0400
Received: from lists.gnu.org ([209.51.188.17]:45596)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <me@HIDDEN>) id 1suUcZ-0002U3-Su
for submit <at> debbugs.gnu.org; Sat, 28 Sep 2024 06:24:16 -0400
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 <me@HIDDEN>) id 1suUc5-0003mu-SP
for bug-gnu-emacs@HIDDEN; Sat, 28 Sep 2024 06:23:45 -0400
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 <me@HIDDEN>) id 1suUc4-0006Ez-Eh
for bug-gnu-emacs@HIDDEN; 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==
From: Eshel Yaron <me@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 31.0.50; [FR] warn about unreachable code
X-Debbugs-Cc:
Date: Sat, 28 Sep 2024 12:23:36 +0200
Message-ID: <m1ploo13h3.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=107.175.124.16; envelope-from=me@HIDDEN;
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-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)
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
Eshel Yaron <me@HIDDEN>:bug-gnu-emacs@HIDDEN.
Full text available.bug-gnu-emacs@HIDDEN:bug#73526; Package emacs.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.