From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Engster Newsgroups: gmane.emacs.devel Subject: Byte compiler and eval-when-compile Date: Mon, 15 Oct 2012 18:23:08 +0200 Message-ID: <87a9vn7lhv.fsf@engster.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1350318219 19003 80.91.229.3 (15 Oct 2012 16:23:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 15 Oct 2012 16:23:39 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 15 18:23:46 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TNnSD-0000nV-QV for ged-emacs-devel@m.gmane.org; Mon, 15 Oct 2012 18:23:45 +0200 Original-Received: from localhost ([::1]:47587 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNnS6-00083i-Vb for ged-emacs-devel@m.gmane.org; Mon, 15 Oct 2012 12:23:38 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:38803) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNnRx-000825-Tz for emacs-devel@gnu.org; Mon, 15 Oct 2012 12:23:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TNnRo-0007p1-C4 for emacs-devel@gnu.org; Mon, 15 Oct 2012 12:23:29 -0400 Original-Received: from randomsample.de ([83.169.19.17]:60196) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNnRn-0007jB-Uk for emacs-devel@gnu.org; Mon, 15 Oct 2012 12:23:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=randomsample.de; s=a; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From; bh=bUy0dduS/5UZEvlZsfXg25NgA7F7cDvpCx/0So2tRCY=; b=UHhCyt0SN4s9IEIHi8Pgz90KdKVOXTIEDdnRO5se5uz8zzbPaLS0nhbXbDnLq1EZtzyDnsTKUYynSF3aKWY3tv+Pt4h0aJBt3aURvQCn0zb95paPtOmwlFvVXuazb9Ft; Original-Received: from dslc-082-083-039-192.pools.arcor-ip.net ([82.83.39.192] helo=spaten) by randomsample.de with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1TNnRe-0001yi-GB for emacs-devel@gnu.org; Mon, 15 Oct 2012 18:23:10 +0200 User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2.50 (gnu/linux) Mail-Followup-To: emacs-devel@gnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 83.169.19.17 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:154353 Archived-At: Somehow the byte compiler got smart during the last days (I think it's the change in rev. 110510). I now get a lot more 'function X might not be defined at runtime' warnings than before. The reason seems to be that it better checks if `eval-when-compile' was used properly. Which is fine and all, but I now have the following problem: In CEDET, we often use `require' statements in function bodies, like this: (defun test() (require 'eldoc) (message "%s" (eldoc-function-argstring '("foo" "bar")))) The reason is simply to only do the require when it is actually needed, so that startup time is reduced. Still, if you byte-compile the above, you'll get a 'might not be defined at runtime' warning for `eldoc-function-argstring'. I used to circumvent that problem by simply doing (eval-when-compile (require 'eldoc)) Before you scream at me: I *know* this is not what `eval-when-compile' is for, but it has worked until a few days ago. It seems the byte-compiler now sees that I'm actually using a function from eldoc, but he still doesn't see that I'm requiring the package it in the function body. Do I now really have to use `declare-function' for all those cases? -David