diff --git a/libtcc.c b/libtcc.c index 7cfd054..068a0fc 100644 --- a/libtcc.c +++ b/libtcc.c @@ -1334,13 +1334,11 @@ ST_FUNC int tcc_add_file_internal(TCCState *s1, const char *filename, int flags) tcc_strdup(filename)); parse_flags = 0; -#ifdef CONFIG_TCC_ASM /* if .S file, define __ASSEMBLER__ like gcc does */ if (filetype == AFF_TYPE_ASM || filetype == AFF_TYPE_ASMPP) { tcc_define_symbol(s1, "__ASSEMBLER__", NULL); parse_flags = PARSE_FLAG_ASM_FILE; } -#endif if (flags & AFF_PREPROCESS) { ret = tcc_preprocess(s1); 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)