Recent change breaks all versions of Emacs
Richard Stallman
rms@gnu.org
Wed Nov 22 05:17:00 GMT 2000
GCC snapshots since late October are unable to build Emacs (all
versions), because cpp now turns `..' into `. .'.
The Emacs makefile is processed with cpp; it has been handled that way
since 1985. (This has a major convenience: the same macros that
control conditionals in the C code can also control conditionals in
the makefiles.) And GNU cpp has been carefully designed to avoid
mistreating non-C data such as makefiles, since it was first
incorporated into GCC.
The Emacs developers started looking for a way to get around this
problem, one of which was to try using --traditional. They found that
this works with GCC 2.95.2, but in the current snapshots has a
conflict with another GCC feature; that is the problem I reported two
days ago.
I believe they have found another way to work around this problem, but
whatever they do will only help Emacs 21 (now in pretest). Emacs 19
and Emacs 20 are still used by users, and the latest cpp breaks them
too. It is impossible to solve this problem properly by changing
Emacs; the only solution is to fix cpp.
One of the Emacs developers reported this response:
| This is a paste avoidance feature, to avoid interpreting separate dot
| tokens as an ellipsis.
The issue of token-pasting, and how to prevent it when ISO C says it
should not happen, arose early in the development of GCC. At that
time I was the Emacs maintainer in addition to writing GCC.
The normal way to prevent token-pasting is by inserting a space. As
other compiler developers started to implement ANSI C in their cpps, I
found from Emacs bug reports that other cpp's inserted these spaces
very often, any time a situation showed the first sign of possible
token-pasting. These cpp's caused problems for Emacs when it was
built with them; fortunately, the same target systems generally
provided an old-style pre-ANSI cpp for situations where cpp was used
on languages other than C.
After studying the situation, I concluded that GNU cpp could serve
both purposes, simply by inserting an anti-pasting space *only when
pasting was actually going to occur* without one. In most of the
cases where token-pasting looks like a possibility, a few simple
checks show that there will be no pasting, so there is no need to
insert a space. Of course, --traditional provides a way to make sure
no anti-pasting spaces will be inserted.
It should be easy to fix the problem, which was introduced by changes
made between Oct 27 and Oct 30, using that approach. It would be good
to add comments to explain that general approach, if there aren't any
now.
By the way, the Emacs developers are considering the difficult job of
replacing the cpp mechanism with something else. This will be hard,
because Emacs contains files for supporting many platforms using the
old cpp conditional mechanism, and many of them are complicated. It
is too late to consider such a major change for Emacs 21.
But use of cpp for things other than C has a long history; I believe
that in Unix some other languages, such as assembler and Fortran,
could be processed with cpp as a standard feature. That may be true
in GCC as well (I can't check from here).
So even if future Emacs versions do not use cpp to process the
makefile, cpp must still be designed to handle languages other than C
as well as it has in the past.
More information about the Gcc
mailing list