From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.devel Subject: Re: Warn about comparing quoted lists (etc) using `eq` Date: Thu, 15 Dec 2022 05:17:13 +0100 Message-ID: References: <8D624413-5A6C-46D7-A4EB-53C23F7CC4D3@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000cd535e05efd62212" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27525"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel To: =?UTF-8?Q?Mattias_Engdeg=C3=A5rd?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Dec 15 05:19:00 2022 Return-path: Envelope-to: ged-emacs-devel@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 1p5fi0-00071S-7b for ged-emacs-devel@m.gmane-mx.org; Thu, 15 Dec 2022 05:19:00 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p5fgx-0004G5-4F; Wed, 14 Dec 2022 23:17:55 -0500 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 1p5fgv-0004Dj-AG for emacs-devel@gnu.org; Wed, 14 Dec 2022 23:17:53 -0500 Original-Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p5fgt-0002iy-Ny for emacs-devel@gnu.org; Wed, 14 Dec 2022 23:17:53 -0500 Original-Received: by mail-ed1-x52b.google.com with SMTP id d20so25503897edn.0 for ; Wed, 14 Dec 2022 20:17:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=zd32Q63EjRj301imVVi9FBB4zk4g6BEcl1NfVqpu4Zw=; b=jaNIB/SICnZUkfwsqpFXTEjQknWt84RLypFVML6ahqNk2VKh8GF4wKqE8rJc+gPmG+ FXdeZx47KJyPc5FX05N2TLVH1C0Jn3rY6zZK7LU1ImTrj/G5RGEfefdmm4+PzeTk/v5A pLo2GzskIb/xpvgr9RxXiULVrxshFtcIOiGJY43Q1zJn9xCqvglBpoxDyBDZWT2I9xjJ LkycAK+kIfEL+xRnQED5XLALsjLA4wOqi6VTK26zVlNBc8DgH+UKHqutPNa4e3a0Rt2C MrZxRSjRS3PgMpVIQX3OXz9QcCAxmpCcTJA7ENhEqTfl57NCpByJJn2Jbas5l5JBjYY+ Bc3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zd32Q63EjRj301imVVi9FBB4zk4g6BEcl1NfVqpu4Zw=; b=FaZ8ss07oBPiL7xuFmxCUON8MDxT4lzALSmdz9SzDWLj7XlapWw7JoaFVOyWsEOK2q cT6oJhGcPnnj+prCJzm4yLYtqK/ekL+NXMMFp90yZ0nllxsk1/JN/ip6WNjwkOOJY3Ua pk4s1/k0WPT9U530DGgK/u6DyrT6LzabZvTZK8EOdYrzspYovnnNhiF6eeaoMhRj/b8+ b/yOvtl3VekqumcJHypGocgGp5VBTXnqRA6lGIl2Ewo8zAtH7YtXl1zLUnrOV2gCQuIq //dZeFYpVpfAhX29k84Qg3t9lnt4/YZmLL7BLBXu3AL0fgmEdOe4UK3ygk6vE6MO0XWa kl3w== X-Gm-Message-State: ANoB5pl3Fz5Nm2t4oC/Y2YaGWiZRlQqZwLedw8iESCrdYH17kxfcXDOs zTQoSajN2rrrkyN9l+VQMtsZYpCfdVAb7F6xIEw= X-Google-Smtp-Source: AA0mqf6VifdYnhOwkwAyD4Uzhi0xavLShh3/S+wDzQS1FL8OB/gD1hfcs6t7MoLNS9n59ZRDDCya+fSd9RqOgqi0LWs= X-Received: by 2002:a05:6402:361:b0:46c:25ea:731 with SMTP id s1-20020a056402036100b0046c25ea0731mr25764633edw.194.1671077869473; Wed, 14 Dec 2022 20:17:49 -0800 (PST) In-Reply-To: <8D624413-5A6C-46D7-A4EB-53C23F7CC4D3@gmail.com> Received-SPF: pass client-ip=2a00:1450:4864:20::52b; envelope-from=lekktu@gmail.com; helo=mail-ed1-x52b.google.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, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:301430 Archived-At: --000000000000cd535e05efd62212 Content-Type: text/plain; charset="UTF-8" Note that your patch has a false positive with the empty string, which is optimized to be always the same object (well, ISTR there are two, a unibyte one and a multibyte one). (byte-compile '(let ((x "")) (eq x ""))) => Warning: `eq' called with literal string that may never match (arg 2) (let ((x "")) (eq x "")) => t --000000000000cd535e05efd62212 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Note that your patch has a false positive with the empty str= ing, which is optimized to be always the same object (well, ISTR there are = two, a unibyte one and a multibyte one).

(byte-compile '(let ((x "")) (eq x "")))=C2=A0= =C2=A0=3D>=C2=A0=C2=A0=C2=A0Warning: `eq' called with literal strin= g that may never match (arg 2)

(let ((x "")) (eq x "&q= uot;)) =3D> t

--000000000000cd535e05efd62212--