unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#20509: compiler warns about cl-defmethod defined after use
@ 2015-05-05 18:16 Glenn Morris
  2015-05-05 20:00 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2015-05-05 18:16 UTC (permalink / raw)
  To: 20509

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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-06  4:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-05 18:16 bug#20509: compiler warns about cl-defmethod defined after use Glenn Morris
2015-05-05 20:00 ` Stefan Monnier
2015-05-06  3:17   ` Glenn Morris
2015-05-06  4:28     ` Stefan Monnier

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).