GNU bug report logs - #14551
compiler fails to track eval-when-compile in required files

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: Glenn Morris <rgm@HIDDEN>; dated Mon, 3 Jun 2013 20:33:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 14551 <at> debbugs.gnu.org:


Received: (at 14551) by debbugs.gnu.org; 3 Jun 2013 21:01:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 03 17:01:10 2013
Received: from localhost ([127.0.0.1]:49433 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UjbsL-0001ey-Q3
	for submit <at> debbugs.gnu.org; Mon, 03 Jun 2013 17:01:10 -0400
Received: from ironport2-out.teksavvy.com ([206.248.154.182]:21266)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <monnier@HIDDEN>) id 1UjbsJ-0001eg-RF
	for 14551 <at> debbugs.gnu.org; Mon, 03 Jun 2013 17:01:08 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: Av4EABK/CFFFpYtM/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDpHqBXoMT
X-IPAS-Result: Av4EABK/CFFFpYtM/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDpHqBXoMT
X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="15541920"
Received: from 69-165-139-76.dsl.teksavvy.com (HELO pastel.home)
	([69.165.139.76])
	by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA;
	03 Jun 2013 16:59:03 -0400
Received: by pastel.home (Postfix, from userid 20848)
	id 9012463332; Mon,  3 Jun 2013 16:59:07 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Glenn Morris <rgm@HIDDEN>
Subject: Re: bug#14551: compiler fails to track eval-when-compile in required
	files
Message-ID: <jwvehciykzu.fsf-monnier+emacs@HIDDEN>
References: <6m8v2r6ios.fsf@HIDDEN>
Date: Mon, 03 Jun 2013 16:59:07 -0400
In-Reply-To: <6m8v2r6ios.fsf@HIDDEN> (Glenn Morris's message of
	"Mon, 03 Jun 2013 16:30:27 -0400")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 14551
Cc: 14551 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

> foo.el:
> (require 'lib)
> (defun foo ()
>   (lib2-func))
[...]
> lib.el:
> (eval-when-compile
>   (require 'lib2))
> (provide 'lib)
[...]
> rm lib*.elc
> emacs -Q -L . -batch -f batch-byte-compile foo.el
> produces no warnings.

Yes, that's a long standing bug.  Fixing it right is likely to be pretty
tricky/difficult because it means we need to disregard some of the
packages already loaded somehow.  In the general case, you have the same
problem even without eval-when-compile, e.g. if you have in lib.el
a call to an autoloaded macro, in which case the autoloaded package will
be loaded if lib.el is not yet compiled but not if it is.

The "noruntime" warnings are implemented with a pile of hacks, and I'd
rather not add to them.  So, given that a proper fix looks pretty
difficult, I wouldn't hold my breath.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#14551; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 3 Jun 2013 20:32:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 03 16:32:24 2013
Received: from localhost ([127.0.0.1]:49418 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UjbQW-0000p6-5E
	for submit <at> debbugs.gnu.org; Mon, 03 Jun 2013 16:32:24 -0400
Received: from fencepost.gnu.org ([208.118.235.10]:51125 ident=Debian-exim)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <rgm@HIDDEN>) id 1UjbQU-0000p0-DH
	for submit <at> debbugs.gnu.org; Mon, 03 Jun 2013 16:32:23 -0400
Received: from rgm by fencepost.gnu.org with local (Exim 4.71)
	(envelope-from <rgm@HIDDEN>)
	id 1UjbOd-0001Jd-LY; Mon, 03 Jun 2013 16:30:27 -0400
From: Glenn Morris <rgm@HIDDEN>
To: submit <at> debbugs.gnu.org
Subject: compiler fails to track eval-when-compile in required files
X-Spook: CNCIS EuroFed Axis of Evil infowar encryption SRI
X-Ran: A&,ZMqXf|BspB3fnJU`W9&fNq3'lt1;ct;Jd=TWgr1}B|PR}N}-[NM3Q0}`#rvgl/0Nd{$
X-Hue: black
X-Debbugs-No-Ack: yes
X-Attribution: GM
Date: Mon, 03 Jun 2013 16:30:27 -0400
Message-ID: <6m8v2r6ios.fsf@HIDDEN>
User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -5.5 (-----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -7.4 (-------)

Package: emacs
Severity: minor
Version: 24.3

(I guess this issue has always been present.)

Suppose we have three files:


foo.el:
(require 'lib)
(defun foo ()
  (lib2-func))


lib.el:
(eval-when-compile
  (require 'lib2))
(provide 'lib)


lib2.el:
(defun lib2-func ()
  t)
(provide 'lib2)


rm lib*.elc
emacs -Q -L . -batch -f batch-byte-compile foo.el

produces no warnings.

If lib.el is compiled first though:
emacs -Q -L . -batch -f batch-byte-compile lib.el
emacs -Q -L . -batch -f batch-byte-compile foo.el

In end of data:
foo.el:6:1:Warning: the function `lib2-func' is not known to be defined.


eval-when-compile is equivalent to progn in uncompiled code, and the
compiler doesn't compile things brought in by require.




Report forwarded to bug-gnu-emacs@HIDDEN:
bug#14551; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 31 Oct 2014 17:00:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.