diff options
| -rw-r--r-- | tccpp.c | 4 | ||||
| -rw-r--r-- | tcctok.h | 1 |
2 files changed, 4 insertions, 1 deletions
@@ -1478,6 +1478,8 @@ static void pragma_parse(TCCState *s1) } next(); skip(')'); + } else if (tok == TOK_once) { + add_cached_include(s1, file->filename, TOK_once); } else { tcc_warning("unknown #pragma %s", get_tok_str(tok, &tokc)); } @@ -1618,7 +1620,7 @@ ST_FUNC void preprocess(int is_bof) } e = search_cached_include(s1, buf1); - if (e && define_find(e->ifndef_macro)) { + if (e && (define_find(e->ifndef_macro) || e->ifndef_macro == TOK_once)) { /* no need to parse the include because the 'ifndef macro' is defined */ #ifdef INC_DEBUG @@ -157,6 +157,7 @@ DEF(TOK_lib, "lib") DEF(TOK_push_macro, "push_macro") DEF(TOK_pop_macro, "pop_macro") + DEF(TOK_once, "once") /* builtin functions or variables */ #ifndef TCC_ARM_EABI |
