From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: How to cause a compiler warning? Date: Mon, 15 Jan 2024 00:16:34 +0000 Message-ID: <87v87ve9i5.fsf@gmail.com> References: <871qak4n4h.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7185"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Richard Stallman , emacs-devel To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jan 15 01:17:26 2024 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 1rPAfO-0001dh-04 for ged-emacs-devel@m.gmane-mx.org; Mon, 15 Jan 2024 01:17:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rPAeg-00037X-Bp; Sun, 14 Jan 2024 19:16:42 -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 1rPAee-000373-No for emacs-devel@gnu.org; Sun, 14 Jan 2024 19:16:40 -0500 Original-Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rPAec-0003Qb-Gq; Sun, 14 Jan 2024 19:16:40 -0500 Original-Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-40e67e90d04so21976085e9.1; Sun, 14 Jan 2024 16:16:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705277795; x=1705882595; darn=gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4E7HAmyiaHp1fT2cXy93RiwE3R8nZWr9vDfQBegn9Jc=; b=VSRnkv659AsO83Fj2kAF6kQQaBSsjY7EzULM8cT9RtLVyAZcnF9cqM7vUe+31almwf Oq+yh5tByx7mOeUMlPmQn8O0WT3fBMTlZQMBHAxm1mm2K5U7n6bQZ4UuujaSVd63a07F ZEmA/WjStRxH2C2b1bxcgi1hUf6Jzxqu1UajDyVI8oc1TTk/jOrEelnIIbn71qc1wpdp 0SfT/5fCunuAQ8wDay/FSsX+ukRnjfTzPLGGCdty/hgwg98R8vuwTivdQl+3Q56ZBeQT n/XZKcfIhXPoILc1tpifcVfUorRxxrvceUVtp9Z8GS1dTVAFh9GjtuDAPEchZH3mUvju KFJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705277795; x=1705882595; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=4E7HAmyiaHp1fT2cXy93RiwE3R8nZWr9vDfQBegn9Jc=; b=YHfKleGLTnogd05i5BgKFBK+8lBbNF+jT/MhtmnGSIQUjilidFpY9a672kwueFHQfO QvrzqCOBvWvl2F+Md10IKgefHeVNS+9RLj+sqpGndbMqZUG6s33EPPQktCFSNfZHbhbs xz32YOR8gHg1IGA5+1JJhbRyHECwKNkNrflSq9HXiImxwkYkPygHtp8kSPzzPN+xKeE1 lY+9gPxx2WcbCL7uqqChPrE5K8BBJ+zAfyFjgI8QQIyy9mJ3avt5ziEE3PonIIhlXrzQ P3vc7OYdZ5IVIAJBlU5ouWbquxwmVTKVc4JYBu8ixs4spRPSSoi6zCHmdS+qgwKbrcpx shQQ== X-Gm-Message-State: AOJu0Yzq/jGSdUiN3Uu7Gv+v4iNn240taSc0/7M87cUz2JwXW53qsheE fY+Vd7cCSfK8aJqmvh0ltEzOFu2ttwk= X-Google-Smtp-Source: AGHT+IGOZhUqqv10kMo6uaPzt4hxD+Vv8qAivwYsyfXA15QKc7dm/6BWwZgetayXdpXsl4B4lq+IzQ== X-Received: by 2002:a05:600c:46d3:b0:40e:5947:bd07 with SMTP id q19-20020a05600c46d300b0040e5947bd07mr2622047wmo.37.1705277795417; Sun, 14 Jan 2024 16:16:35 -0800 (PST) Original-Received: from krug ([87.196.72.99]) by smtp.gmail.com with ESMTPSA id l39-20020a05600c1d2700b0040e50d82af5sm14056097wms.32.2024.01.14.16.16.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jan 2024 16:16:35 -0800 (PST) In-Reply-To: (Alan Mackenzie's message of "Sun, 14 Jan 2024 16:21:43 +0000") Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=joaotavora@gmail.com; helo=mail-wm1-x331.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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:314976 Archived-At: Alan Mackenzie writes: >> Most assuredly not.=C3=82 This may give an incorrect file position= for >> the >> warning. > ... >> Since 29.1, the correct function for a warning has been >> byte-compile-warn-x. > >> Self-evidently so, of course, the 'x' standing for "correct". > > Something like that, yes. I've had a better look at the 'byte-compile-warn-x' helper. I think I understand what it does, but the docstring leaves to be desired, it says the first argument a "source element, likely a symbol with position", which is vague and curious nomenclature I've not seen in other Lisps. More importantly, is there always a "source element" to give to byte-compile-warn-x? Doesn't it depend on the case? Many macros operate on Lisp forms and sometimes there is some obvious good form to hook onto and presumably this form is either is a sym-with-pos or has some such symbols inside it. Like this: (defmacro fooing (a &rest body) (when (eq (car-safe a) 'quote) (byte-compile-warn-x a "don't quote me, silly")) ...) Here, I do agree 'byte-compile-warn-x' is much better than 'byte-compile-warn', as Flymake highlights exactly the symbol in that position. Great. But macros are also just functions and sometimes they need to warn because... it's Wednesday or something. (defmacro define-foos (howmanyfoos) (when (its-wednesday) (byte-compile-warn "Beware code compiled on wednesdays!")) ...) Here, 'byte-compile-warn', which makes the whole 'define-foos' highlighted by Flymake is not only perfectly valid but also the only viable option. So I don't think byte-compiler-warn-x is "most assuredly" the only util you should use. If it were, byte-compiler-warn might as well be deprecated. >> Anyway, what about <29 compatible code? > > What about it? Richard isn't working on < 29 code at the moment. Alright, but since you were so assertive in overriding my suggestion with a fairly new util, maybe you could comment on what to do in code intended to work in those versions, for the benefit of others. Jo=C3=A3o