tccpp: fix quirk with cached headers and #else

Such as with

    #ifndef FOO_H
    ...
    #else
    ...
    #endif
tcc-xref
grischka 2009-07-23 19:21:14 +02:00
parent 1026ca5888
commit 569c20f104
1 changed files with 4 additions and 1 deletions

View File

@ -1392,7 +1392,7 @@ include_done:
if (s1->ifdef_stack_ptr[-1] & 2)
error("#else after #else");
c = (s1->ifdef_stack_ptr[-1] ^= 3);
goto test_skip;
goto test_else;
case TOK_ELIF:
if (s1->ifdef_stack_ptr == s1->ifdef_stack)
error("#elif without matching #if");
@ -1404,6 +1404,9 @@ include_done:
goto skip;
c = expr_preprocess();
s1->ifdef_stack_ptr[-1] = c;
test_else:
if (s1->ifdef_stack_ptr == file->ifdef_stack_ptr + 1)
file->ifndef_macro = 0;
test_skip:
if (!(c & 1)) {
skip: