[PATCH] eliminate elif_ignore, fix handling of unterminated #if
commit8bab495ee7060d307872f0f13153422ccc543c03
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 27 Nov 2005 22:53:14 +0000 (27 17:53 -0500)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 28 Nov 2005 01:40:51 +0000 (27 17:40 -0800)
treee7daf6687100e378d0c49851ebd5b2f478079fc9
parentd9257d98b4f4008fab4e61b3efa5a5415a8600d6
[PATCH] eliminate elif_ignore, fix handling of unterminated #if

No need to bother with stack; we can just keep # tokens from #if...  and
use _those_ as a stack instead.  struct stream gets a pointer to the
current #if..., checks for #elif/#else/#endif out of place become simple
if (!stream->top_if) and stream->ifndef becomes a pointer to token
instead of an integer (pointer to token in that stack instead of nesting
depth).

We lose elif_ignore[] array, if_nesting and stream->nesting (nothing
cares of those anymore) and get sane handling of unterminated #if for
free - instead of reporting the location of the last #if on depth 0
(very likely - in another file and having an #endif) we can give
location of the #if that really lacks #endif.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
pre-process.c
token.h