"#pragma once" implementation
This commit is contained in:
parent
0c8447db79
commit
b08ce88082
2 changed files with 4 additions and 1 deletions
4
tccpp.c
4
tccpp.c
|
@ -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
|
||||
|
|
1
tcctok.h
1
tcctok.h
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue