diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2019-09-30 16:27:17 +0200 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-06-18 21:26:31 +0200 |
commit | 5d390e127ede8a2fa84f78f6f53fcb551bec5908 (patch) | |
tree | 004178a8525915247efa7bb66dad900375623336 | |
parent | 9b14d5925ab2fd17ea5de0b64aab545fdbdee516 (diff) | |
download | sparse-5d390e127ede8a2fa84f78f6f53fcb551bec5908.tar.gz |
pre-process: rename 'expander' into 'expand_simple'
Sparse support the expansion of one-symbol-builtin macros like
__FILE__ or the pre-processor operator 'defined'. It also supports the
expansion of builtin macros with arguments, like __has_attribute()
but only inside a pre-processor conditional expression.
In preparation of adding the general expansion of these macros,
rename the method 'expander' into 'expand_simple'.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | pre-process.c | 8 | ||||
-rw-r--r-- | symbol.h | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/pre-process.c b/pre-process.c index e6becf23..059a7c1d 100644 --- a/pre-process.c +++ b/pre-process.c @@ -229,8 +229,8 @@ static int expand_one_symbol(struct token **list) sym = lookup_macro(token->ident); if (!sym) return 1; - if (sym->expander) { - sym->expander(token); + if (sym->expand_simple) { + sym->expand_simple(token); return 1; } else { int rc; @@ -2040,7 +2040,7 @@ static void init_preprocessor(void) }; static struct { const char *name; - void (*expander)(struct token *); + void (*expand_simple)(struct token *); } dynamic[] = { { "__LINE__", expand_line }, { "__FILE__", expand_file }, @@ -2066,7 +2066,7 @@ static void init_preprocessor(void) for (i = 0; i < ARRAY_SIZE(dynamic); i++) { struct symbol *sym; sym = create_symbol(stream, dynamic[i].name, SYM_NODE, NS_MACRO); - sym->expander = dynamic[i].expander; + sym->expand_simple = dynamic[i].expand_simple; } counter_macro = 0; @@ -160,7 +160,7 @@ struct symbol { struct token *expansion; struct token *arglist; struct scope *used_in; - void (*expander)(struct token *); + void (*expand_simple)(struct token *); }; struct /* NS_PREPROCESSOR */ { int (*handler)(struct stream *, struct token **, struct token *); |