diff --git a/tccpp.c b/tccpp.c index 92a747b82..c0f350b40 100644 --- a/tccpp.c +++ b/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 { diff --git a/tests/tcctest.c b/tests/tcctest.c index f6e6574fd..acd912e16 100644 --- a/tests/tcctest.c +++ b/tests/tcctest.c @@ -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("")