Small preprocessor fix
Set BOL flag for code like: #define tcc_test() #if 1 tcc_test #endif
This commit is contained in:
parent
79a8229fb5
commit
878fcccdb2
2 changed files with 11 additions and 0 deletions
2
tccpp.c
2
tccpp.c
|
@ -3338,6 +3338,8 @@ static int macro_subst_tok(
|
|||
for (i = 0; i < ws_str.len; i++)
|
||||
tok_str_add(tok_str, ws_str.str[i]);
|
||||
}
|
||||
if (ws_str.len && ws_str.str[ws_str.len - 1] == '\n')
|
||||
tok_flags |= TOK_FLAG_BOL;
|
||||
tok_str_free_str(ws_str.str);
|
||||
return 0;
|
||||
} else {
|
||||
|
|
|
@ -4273,11 +4273,14 @@ void func_arg_test(void)
|
|||
/* # define ACCEPT_LF_IN_STRINGS */
|
||||
#endif
|
||||
|
||||
#define tcc_test()
|
||||
|
||||
/* keep this as the last test because GCC messes up line-numbers
|
||||
with the ^L^K^M characters below */
|
||||
void whitespace_test(void)
|
||||
{
|
||||
char *str;
|
||||
int tcc_test = 1;
|
||||
|
||||
#if 1
|
||||
pri\
|
||||
|
@ -4326,6 +4329,12 @@ ntf("min=%d\n", 4);
|
|||
063\\
|
||||
n 456\"\n");
|
||||
|
||||
printf ("%d\n",
|
||||
#if 1
|
||||
tcc_test
|
||||
#endif
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
#define RUN(test) puts("---- " #test " ----"), test(), puts("")
|
||||
|
|
Loading…
Reference in a new issue