[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

byte compiler warnings for different Emacs versions

From: Drew Adams
Subject: byte compiler warnings for different Emacs versions
Date: Tue, 9 Nov 2004 17:35:08 -0800

The byte compiler cannot know which Emacs version a byte-compiled file will
be run in. And I've noticed that in some cases (e.g. delsel.el) a source
file must be byte-compiled separately in Emacs 20 and Emacs 21 for the
compiled result to run properly in each target Emacs version.

Consider this code:

  (when (< emacs-major-version 21)(setq foo bar))

If this is byte-compiled in Emacs 21, we get these warnings:

Compiling file test.el at Tue Nov 09 16:51:17 2004
test.el:2:13:Warning: reference to free variable `bar'
test.el:2:9:Warning: assignment to free variable `foo'

Can we presume that the compiled result will be run in Emacs 21? Probably
not. If we could, then the compiler should not produce such warnings; it
should ignore the guarded code.

[Note: If the opposite test is made (conditionalize code for >= 21 and
byte-compile in Emacs 20), no such warnings are issued, so this changed
behavior is presumably a useful feature.]

Since we cannot presume that the result will be run in Emacs 21, a warning
is in order, but it would be useful if such version-specific warnings could
be  labeled as such. Also useful would be an option (e.g. via prefix arg) to
the byte-compile functions that would turn off errors for versions different
from the current (byte-compiler) version.

In GNU Emacs (i386-mingw-nt5.1.2600)
 of 2004-07-26 on BERATUNG4
configured using `configure --with-gcc
(3.3) --cflags -I../../jpeg-6b-1/include -I../../libpng-1.2.4-1/include -I..
/../tiff-3.5.7/include -I../../xpm-nox-4.2.0/include -I../../zlib-1.1.4-1/in

reply via email to

[Prev in Thread] Current Thread [Next in Thread]