2013/8/8 Stefan Monnier : >> (defun foo (&rest args) t) >> (defun foo2 () (mapcar #'foo '(1 2 3))) > [...] >> foo.el:6:1:Warning: the function `foo' is not known to be defined. > >> (defun foo () #'assoc-ignore-case) > [...] >> foo.el:1:8:Warning: `function' is an obsolete variable. > > The patch below should fix them, indeed, thanks. > > > Stefan > > > === modified file 'lisp/emacs-lisp/bytecomp.el' > --- lisp/emacs-lisp/bytecomp.el 2013-08-07 17:33:30 +0000 > +++ lisp/emacs-lisp/bytecomp.el 2013-08-08 01:23:52 +0000 > @@ -3574,12 +3574,12 @@ > (when (and (symbolp f) > (byte-compile-warning-enabled-p 'callargs)) > (when (get f 'byte-obsolete-info) > - (byte-compile-warn-obsolete (car form))) > + (byte-compile-warn-obsolete f)) > > ;; Check to see if the function will be available at runtime > ;; and/or remember its arity if it's unknown. > (or (and (or (fboundp f) ; Might be a subr or autoload. > - (byte-compile-fdefinition (car form) nil)) > + (byte-compile-fdefinition f nil)) > (not (memq f byte-compile-noruntime-functions))) > (eq f byte-compile-current-form) ; ## This doesn't work > ; with recursion. > Applying either of your patches fails for me; Is there some possibility we can check, that we are actually starting from the same version of bytecomp.el? I have to admit, I don't have particularily much experience with patchibg files... What I intended to check: Does your code allow defining a function after its first use as #'FUNCTION, as is allowed with normal function calls (FUNCTION ...)? >> (funcall (if t #'foo) "Hello World") > >(if t #'foo) gets optimized into #'foo. Okay, I missed that one. If I write (funcall (if (some-condition) #'foo) nil) it warns only about some-condition. I have now moved the call to `byte-compile--higher-order--check-arguments' to `byte-compile-form' in my code. The code (funcall (if (some-condition) #'foo) nil) (mapc 'foo nil) (ignore '(#'bar)) No produces the warnings ------------------------------------------------------- In toplevel form: id1379159421d7d15c.el:7:1:Warning: mapc: Function argument should be passed as #'foo, not (quote foo) In end of data: id1379159421d7d15c.el:11:1:Warning: The symbol `foo' was used as function name but the function is not known to be defined. id1379159421d7d15c.el:11:1:Warning: the function `some-condition' is not known to be defined. Wrote c:/tmp/id1379159421d7d15c.elc Done. ------------------------------------------------------- - Klaus