From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Vinicius Jose Latorre Newsgroups: gmane.emacs.devel Subject: Re: Question about byte-compiler warning Date: Tue, 25 Sep 2007 15:51:02 -0300 Message-ID: <46F95896.4090509@ig.com.br> References: <46F92B6F.2000101@ig.com.br> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1190746069 2223 80.91.229.12 (25 Sep 2007 18:47:49 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 25 Sep 2007 18:47:49 +0000 (UTC) Cc: "GNU Emacs \(devel\)" To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 25 20:47:44 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IaFRa-0003yv-DR for ged-emacs-devel@m.gmane.org; Tue, 25 Sep 2007 20:47:38 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IaFRX-0000Pl-Bi for ged-emacs-devel@m.gmane.org; Tue, 25 Sep 2007 14:47:35 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IaFRT-0000MW-PS for emacs-devel@gnu.org; Tue, 25 Sep 2007 14:47:31 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IaFRR-0000IK-Jz for emacs-devel@gnu.org; Tue, 25 Sep 2007 14:47:31 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IaFRR-0000IA-EU for emacs-devel@gnu.org; Tue, 25 Sep 2007 14:47:29 -0400 Original-Received: from an-out-0708.google.com ([209.85.132.245]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IaFRR-0003Iy-3N for emacs-devel@gnu.org; Tue, 25 Sep 2007 14:47:29 -0400 Original-Received: by an-out-0708.google.com with SMTP id c25so250423ana for ; Tue, 25 Sep 2007 11:47:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; bh=WDhhFqSWF/Ufyi4f7lHB5HjoVD83yWbg2HVtZzYOnQE=; b=eekZ3+1rOCGzivYbFqxbWU/bjXtilVeVDaxyU0B7xpKu0tIfWTx6NBhPU9qbQ9v16U0IC/PelWSANIq5YwEVO5obVbQVrZJ5pfMxMpK0tt62RAJnCce25OigaVmjBlXM5/H6WYKp6inpgAktQyQw3iZXadJF0yYG5AeIyX/1Bb8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=dxsBXDi15C2ZscX5eT4cj0Eq1pjfq+UzHJELvfsYieEH43rFwTCvhthMspS+adVMJKWlt8gHGS0b/mw4YVenmR2mW1FQAeZ4YfI3SD9vhimmLNQjXyPEHDZhgacvtQuwNHM1IHju+f+2aQf5yGJj58zb9gbC4rDTweANErtyf5w= Original-Received: by 10.100.120.5 with SMTP id s5mr9561978anc.1190746048418; Tue, 25 Sep 2007 11:47:28 -0700 (PDT) Original-Received: from ?192.168.0.100? ( [201.82.226.236]) by mx.google.com with ESMTPS id o61sm1929527hsc.2007.09.25.11.47.24 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 25 Sep 2007 11:47:26 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.6) Gecko/20070802 SeaMonkey/1.1.4 In-Reply-To: X-Detected-Kernel: Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:79838 Archived-At: Stefan Monnier wrote: >> 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 > (lambda (bla) bli) > (lambda (blo) blu))) > > When the condition is used for several functions, this is a bit > inconvenient, tho. > Ok, but wasn't the construction: (cond ((featurep 'xemacs) ) (t )) recognized by the byte-compiler as a kind of conditional byte-compilation? BTW, the byte-compiler gives no warning to the construction: (eval-and-compile (cond ((featurep 'xemacs) ) (t )))) It could also be used as an alternative construction. Vinicius