From 5d390e127ede8a2fa84f78f6f53fcb551bec5908 Mon Sep 17 00:00:00 2001 From: Luc Van Oostenryck Date: Mon, 30 Sep 2019 16:27:17 +0200 Subject: 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 --- pre-process.c | 8 ++++---- 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; diff --git a/symbol.h b/symbol.h index a16a27c2..6b483101 100644 --- a/symbol.h +++ b/symbol.h @@ -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 *); -- cgit 1.2.3-korg