From 76b88e22a483d9ac16698db0e713e85f98e09fcd Mon Sep 17 00:00:00 2001 From: herman ten brugge Date: Mon, 12 Sep 2022 11:37:47 +0200 Subject: [PATCH] Fix last __has_include update After this last change the radare2 project did not compile anymore. Start with BOL flag after include ends in tccpp.c. Update testcase 18. --- tccpp.c | 3 ++- tests/tests2/18_include.c | 1 + tests/tests2/18_include.h | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tccpp.c b/tccpp.c index 08b70ba7..1e688f7c 100644 --- a/tccpp.c +++ b/tccpp.c @@ -2633,7 +2633,8 @@ static inline void next_nomacro1(void) s1->include_stack_ptr--; p = file->buf_ptr; if (p == file->buffer) - tok_flags = TOK_FLAG_BOF|TOK_FLAG_BOL; + tok_flags = TOK_FLAG_BOF; + tok_flags |= TOK_FLAG_BOL; goto redo_no_start; } } else { diff --git a/tests/tests2/18_include.c b/tests/tests2/18_include.c index 4ec733c2..a85327e5 100644 --- a/tests/tests2/18_include.c +++ b/tests/tests2/18_include.c @@ -4,6 +4,7 @@ int main() { printf("including\n"); #include "18_include.h" +#define test_missing_nl printf("done\n"); #define INC "18_include.h" diff --git a/tests/tests2/18_include.h b/tests/tests2/18_include.h index dc860802..cad2433f 100644 --- a/tests/tests2/18_include.h +++ b/tests/tests2/18_include.h @@ -1 +1,5 @@ printf("included\n"); +/* test file with missing newline */ +#ifndef INCLUDE +#define INCLUDE +#endif /* INCLUDE */ \ No newline at end of file