History

preprocess: "assign PARSE_FLAG_ASM_COMMENTS only for asm files"

resolve a problem with the following test.c program, tcc -E test.c #ifdef _XOPEN_SOURCE # define __USE_XOPEN 1 # if (_XOPEN_SOURCE - 0) >= 500 # define __USE_XOPEN_EXTENDED 1 # define __USE_UNIX98 1 # undef _LARGEFILE_SOURCE # define _LARGEFILE_SOURCE 1 # if (_XOPEN_SOURCE - 0) >= 600 # define __USE_XOPEN2K 1 # undef __USE_ISOC99 # define __USE_ISOC99 1 # endif # else # ifdef _XOPEN_SOURCE_EXTENDED # define __USE_XOPEN_EXTENDED 1 # endif # endif #endif int main() {} // # 17 "aaa.c" // aaa.c:17: error: #endif without matching #if

seyko committed 11 years ago

Commit 2df29001 parent 2d345832 files · +3 −4Browse files

Unified · Split

2 files
  1. libtcc.c +1 −1
  2. tccpp.c +2 −3
libtcc.c+1−1
@@ -1166,7 +1166,7 @@ ST_FUNC int tcc_add_file_internal(TCCState *s1, const char *filename, int flags, · 1165 unmodified lines
11661166 /* if .S file, define __ASSEMBLER__ like gcc does */
11671167 if ((filetype == TCC_FILETYPE_ASM) || (filetype == TCC_FILETYPE_ASM_PP)) {
11681168 tcc_define_symbol(s1, "__ASSEMBLER__", NULL);
1169− parse_flags = PARSE_FLAG_ASM_FILE;
1169+ parse_flags = PARSE_FLAG_ASM_FILE | PARSE_FLAG_ASM_COMMENTS;
11701170 }
11711171 #endif
11721172
tccpp.c+2−3
@@ -3290,9 +3290,8 @@ ST_FUNC int tcc_preprocess(TCCState *s1) · 3289 unmodified lines
32903290 preprocess_init(s1);
32913291 ch = file->buf_ptr[0];
32923292 tok_flags = TOK_FLAG_BOL | TOK_FLAG_BOF;
3293− parse_flags = (parse_flags & PARSE_FLAG_ASM_FILE);
3294− parse_flags |= PARSE_FLAG_ASM_COMMENTS | PARSE_FLAG_PREPROCESS |
3295− PARSE_FLAG_LINEFEED | PARSE_FLAG_SPACES;
3293+ parse_flags &= (PARSE_FLAG_ASM_FILE | PARSE_FLAG_ASM_COMMENTS);
3294+ parse_flags |= PARSE_FLAG_PREPROCESS | PARSE_FLAG_LINEFEED | PARSE_FLAG_SPACES;
32963295 token_seen = 0;
32973296 file->line_ref = 0;
32983297 file_ref = NULL;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t