"#pragma once" implementation
This commit is contained in:
4
tccpp.c
4
tccpp.c
@ -1478,6 +1478,8 @@ static void pragma_parse(TCCState *s1)
|
|||||||
}
|
}
|
||||||
next();
|
next();
|
||||||
skip(')');
|
skip(')');
|
||||||
|
} else if (tok == TOK_once) {
|
||||||
|
add_cached_include(s1, file->filename, TOK_once);
|
||||||
} else {
|
} else {
|
||||||
tcc_warning("unknown #pragma %s", get_tok_str(tok, &tokc));
|
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);
|
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'
|
/* no need to parse the include because the 'ifndef macro'
|
||||||
is defined */
|
is defined */
|
||||||
#ifdef INC_DEBUG
|
#ifdef INC_DEBUG
|
||||||
|
|||||||
1
tcctok.h
1
tcctok.h
@ -157,6 +157,7 @@
|
|||||||
DEF(TOK_lib, "lib")
|
DEF(TOK_lib, "lib")
|
||||||
DEF(TOK_push_macro, "push_macro")
|
DEF(TOK_push_macro, "push_macro")
|
||||||
DEF(TOK_pop_macro, "pop_macro")
|
DEF(TOK_pop_macro, "pop_macro")
|
||||||
|
DEF(TOK_once, "once")
|
||||||
|
|
||||||
/* builtin functions or variables */
|
/* builtin functions or variables */
|
||||||
#ifndef TCC_ARM_EABI
|
#ifndef TCC_ARM_EABI
|
||||||
|
|||||||
Reference in New Issue
Block a user