diff options
| author | grischka <grischka> | 2016-10-04 17:31:40 +0200 |
|---|---|---|
| committer | grischka <grischka> | 2016-10-04 17:31:40 +0200 |
| commit | 1c4cf1855632d712a67f3cc28e43469f8b5f936a (patch) | |
| tree | 9544f2804527c4847f0783211766d1378c3e451a /tccpp.c | |
| parent | 5805b07218aef3c1049b5db9d89841d383ee917d (diff) | |
| download | tinycc-1c4cf1855632d712a67f3cc28e43469f8b5f936a.tar.gz tinycc-1c4cf1855632d712a67f3cc28e43469f8b5f936a.tar.bz2 | |
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).
Diffstat (limited to 'tccpp.c')
| -rw-r--r-- | tccpp.c | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -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) |
