From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#64232: 28.2; Incorrect(?) byte compilation warning about =?UTF-8?Q?=E2=80=98ansi-color-apply-on-region=E2=80=99?= Date: Sat, 24 Jun 2023 14:49:43 +0300 Message-ID: <83o7l5yt9k.fsf@gnu.org> References: <874jmzs23h.wl-zack@owlfolio.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-7 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="842"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 64232@debbugs.gnu.org To: Zack Weinberg , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 24 13:50:46 2023 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 1qD1mw-000Abg-4X for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 24 Jun 2023 13:50:46 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qD1mJ-0000yO-Bh; Sat, 24 Jun 2023 07:50:07 -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 1qD1mG-0000xz-Cp for bug-gnu-emacs@gnu.org; Sat, 24 Jun 2023 07:50:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qD1mE-0000yS-Ry for bug-gnu-emacs@gnu.org; Sat, 24 Jun 2023 07:50:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qD1mE-0005cF-CA for bug-gnu-emacs@gnu.org; Sat, 24 Jun 2023 07:50:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 24 Jun 2023 11:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64232 X-GNU-PR-Package: emacs Original-Received: via spool by 64232-submit@debbugs.gnu.org id=B64232.168760738221551 (code B ref 64232); Sat, 24 Jun 2023 11:50:02 +0000 Original-Received: (at 64232) by debbugs.gnu.org; 24 Jun 2023 11:49:42 +0000 Original-Received: from localhost ([127.0.0.1]:40003 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qD1lt-0005bX-G7 for submit@debbugs.gnu.org; Sat, 24 Jun 2023 07:49:41 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:46486) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qD1lo-0005bI-45 for 64232@debbugs.gnu.org; Sat, 24 Jun 2023 07:49:39 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qD1li-0000sJ-Cz; Sat, 24 Jun 2023 07:49:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=1ebS8DPg/9Yi46zS3eH9Tt6IOWo4hQe23oJb5UTWvC0=; b=ClfxdcJY8T+mWvvabILk gdsZbdgR56IiUk5/TiIQKf+K9dBD0M41hDN1w5rfsygc9CUAvno9gmn2OXCI8lBmRipf/36n2Iwn2 S8QTO/CaDz2A/XbygronYaKm4KGl7isYlF72UCk48+MKsOB6vjpN2b0K6cV7sTX+fhfNOAxDHBHgp Hvieju2okCpU47P8hIQ9hbaUHkOd2vovxSiKCr2jnMUFajrispkpsF8V5wJCSAseHXimRcqmZFSC5 GvH/3flG+62DklVLBuUuGrB52UGPFeNXOhWh+koUTAEvKZXbrcQajYKubwIDy8S4PlNvezJYjUXGT jWYmobX/9usDBA==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qD1lg-0001a9-08; Sat, 24 Jun 2023 07:49:30 -0400 In-Reply-To: <874jmzs23h.wl-zack@owlfolio.org> (message from Zack Weinberg on Thu, 22 Jun 2023 15:56:18 -0400) 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:263985 Archived-At: > Date: Thu, 22 Jun 2023 15:56:18 -0400 > From: Zack Weinberg > > > With Emacs 28.2, this test .el file > > ``` > ;; -*- lexical-binding: t; coding: utf-8 -*- > > (declare-function ansi-color-apply-on-region "ansi-color" > (begin end &optional preserve-sequences)) > (autoload 'ansi-color-apply-on-region "ansi-color") > > (eval-when-compile > (check-declare-file byte-compile-current-file)) > > (defun zw-colorize-compilation-buffer () > "Interpret ANSI color escapes in a compilation-mode buffer, which > gets them out of the way of the error detector. Intended for use via > compilation-filter-hook." > (interactive) > (let ((inhibit-read-only t)) > (ansi-color-apply-on-region (point-min) (point-max)))) > ``` > > provokes a byte compilation warning: > > ``` > $ emacs -Q --batch -f batch-byte-compile test.el > uncompressing ansi-color.el.gz... > uncompressing ansi-color.el.gz...done > > In end of data: > test.el:16:6: Warning: the function ¡ansi-color-apply-on-region¢ might not be > defined at runtime. > ``` > > The combination of `declare-function` and `autoload` is intended to > ensure both that the byte compiler understands what¢s going on, and > that `ansi-color-apply-on-region` really is guaranteed to be available > at runtime. Also, I triple-checked that ansi-color.el really does > define this function. Why is the compiler still complaining? The problem is this part: (eval-when-compile (check-declare-file byte-compile-current-file)) Remove it, and the problem will go away. So there's actually no problem here with 'autoload' and 'declare-function'. I don't understand why you are calling check-declare-file, and moreover don't understand the argument you pass check-declare-file. check-declare-file is a command supposed to be used interactively to verify the 'declare' calls are valid in a given file; it shows the results, if any, as delayed-warnings. Can you explain why you do this in the eval-when-compile form?