aboutsummaryrefslogtreecommitdiff
path: root/tccpp.c
diff options
context:
space:
mode:
Diffstat (limited to 'tccpp.c')
-rw-r--r--tccpp.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/tccpp.c b/tccpp.c
index b892b2e..603a65e 100644
--- a/tccpp.c
+++ b/tccpp.c
@@ -1471,8 +1471,11 @@ static void pragma_parse(TCCState *s1)
tcc_warning("unbalanced #pragma pop_macro");
} else if (tok == TOK_once) {
- add_cached_include(s1, file->filename, TOK_once);
+ char buf1[sizeof file->filename];
+ pstrcpy(buf1, sizeof(buf1), "#once#");
+ pstrcat(buf1, sizeof(buf1), file->filename);
+ add_cached_include(s1, file->filename, tok_alloc(buf1, strlen(buf1))->tok);
} else if (s1->ppfp) {
/* tcc -E: keep pragmas below unchanged */
unget_tok(' ');
@@ -1670,7 +1673,7 @@ ST_FUNC void preprocess(int is_bof)
pstrcat(buf1, sizeof(buf1), buf);
e = search_cached_include(s1, buf1);
- if (e && (define_find(e->ifndef_macro) || e->ifndef_macro == TOK_once)) {
+ if (e && define_find(e->ifndef_macro)) {
/* no need to parse the include because the 'ifndef macro'
is defined */
#ifdef INC_DEBUG