unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Glenn Morris <rgm@gnu.org>
To: 20509@debbugs.gnu.org
Subject: bug#20509: compiler warns about cl-defmethod defined after use
Date: Tue, 05 May 2015 14:16:14 -0400	[thread overview]
Message-ID: <9g8ud2ubyp.fsf@fencepost.gnu.org> (raw)

Package: emacs
Version: 25.0.50

Compiling foo.el with contents:
    
    (require 'cl-lib)
    
    (defun foo-1 ()
      (foo-2))
    
    (cl-defmethod foo-2 ()
      t)

results in:

   In end of data:
   foo.el:8:1:Warning: the function `foo-2' is not known to be defined.


There is no such warning when using defun instead of cl-defmethod,
or if foo-2 is moved before foo-1.


I see that cl-defmethod macroexpands to something using declare-function.
Adding

  (setq byte-compile-unresolved-functions
       (delq (assq fn byte-compile-unresolved-functions)
             byte-compile-unresolved-functions))

to byte-compile-macroexpand-declare-function solves the issue,
but I'm not sure it is right, since it might stop
byte-compile-arglist-warn doing its job (?).

On the other hand, it would be consistent with what
byte-compile-file-form-autoload does (see comment in the code).

On the other other hand, declare-function's currently have to come
before any use of the function thay are declaring, which is somewhat
intentional.





             reply	other threads:[~2015-05-05 18:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-05 18:16 Glenn Morris [this message]
2015-05-05 20:00 ` bug#20509: compiler warns about cl-defmethod defined after use Stefan Monnier
2015-05-06  3:17   ` Glenn Morris
2015-05-06  4:28     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9g8ud2ubyp.fsf@fencepost.gnu.org \
    --to=rgm@gnu.org \
    --cc=20509@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).