From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Davis Herring" Newsgroups: gmane.emacs.devel Subject: Re: Science to suppress compiler warnings Date: Tue, 2 Jun 2009 16:36:22 -0700 (PDT) Message-ID: <46717.130.55.118.19.1243985782.squirrel@webmail.lanl.gov> References: <87fxeigro9.wl%xma@gnu.org> Reply-To: herring@lanl.gov NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1243985804 20129 80.91.229.12 (2 Jun 2009 23:36:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 2 Jun 2009 23:36:44 +0000 (UTC) Cc: emacs-devel@gnu.org To: "Xavier Maillard" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 03 01:36:41 2009 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 1MBdX6-0007xV-1K for ged-emacs-devel@m.gmane.org; Wed, 03 Jun 2009 01:36:40 +0200 Original-Received: from localhost ([127.0.0.1]:48085 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MBdX4-00025C-RV for ged-emacs-devel@m.gmane.org; Tue, 02 Jun 2009 19:36:38 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MBdWy-000231-Qp for emacs-devel@gnu.org; Tue, 02 Jun 2009 19:36:32 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MBdWu-0001vD-3l for emacs-devel@gnu.org; Tue, 02 Jun 2009 19:36:32 -0400 Original-Received: from [199.232.76.173] (port=60130 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MBdWu-0001uz-0B for emacs-devel@gnu.org; Tue, 02 Jun 2009 19:36:28 -0400 Original-Received: from proofpoint2.lanl.gov ([204.121.3.26]:60148) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MBdWr-0006cy-Bz; Tue, 02 Jun 2009 19:36:25 -0400 Original-Received: from mailrelay2.lanl.gov (mailrelay2.lanl.gov [128.165.4.103]) by proofpoint2.lanl.gov (8.14.3/8.14.3) with ESMTP id n52NaMgw000649; Tue, 2 Jun 2009 17:36:22 -0600 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by mailrelay2.lanl.gov (Postfix) with ESMTP id 5BAE01A8CBB2; Tue, 2 Jun 2009 17:36:22 -0600 (MDT) X-NIE-2-Virus-Scanner: amavisd-new at mailrelay2.lanl.gov Original-Received: from webmail1.lanl.gov (webmail1.lanl.gov [128.165.4.106]) by mailrelay2.lanl.gov (Postfix) with ESMTP id 44B701A8CB26; Tue, 2 Jun 2009 17:36:22 -0600 (MDT) Original-Received: by webmail1.lanl.gov (Postfix, from userid 48) id 429591518033; Tue, 2 Jun 2009 17:36:22 -0600 (MDT) Original-Received: from 130.55.118.19 (SquirrelMail authenticated user 196434) by webmail.lanl.gov with HTTP; Tue, 2 Jun 2009 16:36:22 -0700 (PDT) In-Reply-To: <87fxeigro9.wl%xma@gnu.org> User-Agent: SquirrelMail/1.4.8-5.7.lanl1 X-Priority: 3 (Normal) Importance: Normal X-Proofpoint-Virus-Version: vendor=fsecure engine=1.12.8161:2.4.5, 1.2.40, 4.0.166 definitions=2009-06-02_17:2009-06-01, 2009-06-02, 2009-06-02 signatures=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) 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:111296 Archived-At: > Elisp manual at "Compiler Errors" section (16.6) says we should > conditionalize variable use with a boundp test (same thing for > undefined function) but I find it very unpractical. > > I thought (probably was wrong) that: > > (eval-when-compile (defvar foo nil)) > > would do the trick. Is it the correct way to avoid warnings ? That should work if you have confidence that it will be defined (and non-void) at runtime. The [f]boundp, of course, will let you react to it not existing then, if there's a real possibility (as with an old Emacs version) of it not being there. > Also while at it, here is what I got when compiling an old > package: > > records.el:931:49:Warning: reference to free variable > `records-link-menu-map' > > In records-mode: > records.el:1066:23:Warning: assignment to free variable > `records-link-menu-map' > > What is the difference between these two warnings exactly ? > Adding a defvar at the right place fixed that but to feed my > curiosity. The first is for reading, the second for writing; that's all. Davis -- This product is sold by volume, not by mass. If it appears too dense or too sparse, it is because mass-energy conversion has occurred during shipping.