From 1c4cf1855632d712a67f3cc28e43469f8b5f936a Mon Sep 17 00:00:00 2001 From: grischka Date: Tue, 4 Oct 2016 17:31:40 +0200 Subject: tccpp: no cache for include if #elif seen #ifndef guards are cached, however after #elif on the same level, the file must be re-read. Also: preprocess asm as such even when there is no assembler (arm). --- tccpp.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'tccpp.c') diff --git a/tccpp.c b/tccpp.c index d1e6b59..d08277a 100644 --- a/tccpp.c +++ b/tccpp.c @@ -1773,7 +1773,7 @@ ST_FUNC void preprocess(int is_bof) buf1[0] = 0; } else if (i == 1) { - /* search in current dir if "header.h" */ + /* search in file's dir if "header.h" */ if (c != '\"') continue; path = file->filename; @@ -1860,16 +1860,17 @@ include_done: if (c > 1) tcc_error("#elif after #else"); /* last #if/#elif expression was true: we skip */ - if (c == 1) - goto skip; - c = expr_preprocess(); - s1->ifdef_stack_ptr[-1] = c; + if (c == 1) { + c = 0; + } else { + 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: preprocess_skip(); is_bof = 0; goto redo; @@ -1899,10 +1900,10 @@ include_done: case TOK_LINE: next(); if (tok != TOK_CINT) -_line_err: + _line_err: tcc_error("wrong #line format"); n = tokc.i; -_line_num: + _line_num: next(); if (tok != TOK_LINEFEED) { if (tok == TOK_STR) -- cgit v1.3.1