From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Vinicius Jose Latorre <viniciusjl@ig.com.br>
Cc: "GNU Emacs \(devel\)" <emacs-devel@gnu.org>
Subject: Re: Question about byte-compiler warning
Date: Tue, 25 Sep 2007 13:13:56 -0400 [thread overview]
Message-ID: <jwvodfqoel5.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <46F92B6F.2000101@ig.com.br> (Vinicius Jose Latorre's message of "Tue\, 25 Sep 2007 12\:38\:23 -0300")
> Create a test file like:
> test.el:
> ========
> (cond
> ((featurep 'xemacs)
> (defun bar ()
> (message "bar XEmacs"))
> (defun foo ()
> (bar)))
> (t
> (defun bar ()
> (message "bar Emacs"))
> (defun foo ()
> (bar))))
> (defun foobar ()
> (interactive)
> (foo))
> ========
> Now byte-compile the file above.
> The byte-compiler gives the following warning:
> In end of data:
> test.el:17:1:Warning: the following functions are not known to be
> defined:
> bar, foo
> But aren't these functions (bar and foo) defined using cond construct?
> Why does the byte-compiler give this warning?
The byte-compiler only considers as defined a function which is trivially
obviously defined without having to do any kind of analysis. I.e. it
doesn't look inside conditionals (or even inside `let's) to figure out what
might be defined in there.
A workaround I use sometimes is
(defalias 'foo
(if <toto>
(lambda (bla) bli)
(lambda (blo) blu)))
When the condition <toto> is used for several functions, this is a bit
inconvenient, tho.
Stefan
next prev parent reply other threads:[~2007-09-25 17:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-25 15:38 Question about byte-compiler warning Vinicius Jose Latorre
2007-09-25 17:13 ` Stefan Monnier [this message]
2007-09-25 18:51 ` Vinicius Jose Latorre
2007-09-26 14:06 ` Stefan Monnier
2007-09-26 16:35 ` Vinicius Jose Latorre
2007-09-26 16:30 ` Richard Stallman
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvodfqoel5.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
--cc=viniciusjl@ig.com.br \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.