some fixes

This commit is contained in:
ceriel
1989-05-29 11:32:23 +00:00
parent 33022cdf20
commit 03fde8ecde
4 changed files with 19 additions and 17 deletions

View File

@@ -132,7 +132,7 @@ domacro()
}
PRIVATE
skip_block()
skip_block(to_endif)
{
/* skip_block() skips the input from
1) a false #if, #ifdef, #ifndef or #elif until the
@@ -173,7 +173,7 @@ skip_block()
push_if();
break;
case K_ELIF:
if (nestlevel == skiplevel) {
if (! to_endif && nestlevel == skiplevel) {
nestlevel--;
push_if();
if (ifexpr()) {
@@ -183,11 +183,13 @@ skip_block()
}
break;
case K_ELSE:
++(ifstack[nestlevel]);
if (nestlevel == skiplevel) {
SkipRestOfLine();
NoUnstack--;
return;
if (! to_endif) {
++(ifstack[nestlevel]);
if (nestlevel == skiplevel) {
SkipRestOfLine();
NoUnstack--;
return;
}
}
break;
case K_ENDIF:
@@ -328,7 +330,7 @@ do_elif()
else { /* restart at this level as if a #if is detected. */
nestlevel--;
push_if();
skip_block();
skip_block(1);
}
}
@@ -340,7 +342,7 @@ do_else()
lexerror("#else without corresponding #if");
else { /* mark this level as else-d */
++(ifstack[nestlevel]);
skip_block();
skip_block(1);
}
}
@@ -359,7 +361,7 @@ do_if()
{
push_if();
if (!ifexpr()) /* a false #if/#elif expression */
skip_block();
skip_block(0);
}
PRIVATE
@@ -377,7 +379,7 @@ do_ifdef(how)
(how && !id->id_macro) || (!how && id->id_macro)
*/
if (how ^ (id && id->id_macro != 0))
skip_block();
skip_block(0);
else
SkipRestOfLine();
}