inline: avoid node of node on variadics
PATCH 1/1 inline: avoid node of node on variadics
From: Luc Van Oostenryck <[email protected]>
When inlining a variadic function (unsupported in general by sparse but OK when the arguments are unused and occurs as such in the kernel), the extra arguments are added in the declaration list as SYM_NODE.
But the base type of these nodes are the effective arguments and are, as such, already SYM_NODEs. So, nodes of nodes are created and Sparse doesn't support those (these nodes must be merged).
Fix this, by simply copying the effective argument, like done for the non-variadic ones.
Note: Sparse doesn't really support inlining of variadic functions
but is fine when the arguments are not used (and such cases occur in the kernel).
--- inline.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
inline.c +2 -1
@@ -542,11 +542,12 @@ int inline_function(struct expression *expr, struct symbol *sym) FOR_EACH_PTR(arg_list, arg) {struct symbol *a =alloc_symbol (arg->pos,SYM_NODE ); - a->ctype.base_type = arg->ctype;if (name) { *a = *name;set_replace (name, a);add_symbol (&fn_symbol_list, a); + }else { + *a = *arg->ctype; } a->initializer = arg;add_symbol (&arg_decl, a);
Signature · 1 line
2.36.1
Hi Luc,
I was just about to comment on this patch when I noticed [PATCH 2/6] of a new series, which, if I'm reading it correctly replaces this patch; yes?
[I have been a little tardy recently, but I do try to read all patches! ;) ]
ATB,
Ramsay Jones
Quoted 41 lines · Luc Van Oostenryck
From: Luc Van Oostenryck <[email protected]>
When inlining a variadic function (unsupported in general by sparse but OK when the arguments are unused and occurs as such in the kernel), the extra arguments are added in the declaration list as
SYM_NODE.But the base type of these nodes are the effective arguments and are, as such, already
SYM_NODEs. So, nodes of nodes are created and Sparse doesn't support those (these nodes must be merged).Fix this, by simply copying the effective argument, like done for the non-variadic ones.
Note: Sparse doesn't really support inlining of variadic functions
but is fine when the arguments are not used (and such cases occur in the kernel).Signed-off-by Luc Van Oostenryck <[email protected]>--- inline.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)inline.c +2
-1@@ -542,11 +542,12 @@ int inline_function(struct expression *expr, struct symbol *sym) FOR_EACH_PTR(arg_list, arg) {struct symbol *a =alloc_symbol (arg->pos,SYM_NODE ); - a->ctype.base_type = arg->ctype;if (name) { *a = *name;set_replace (name, a);add_symbol (&fn_symbol_list, a); + }else { + *a = *arg->ctype; } a->initializer = arg;add_symbol (&arg_decl, a);
Quoted 1 line · Ramsay Jones
Hi Luc,
Hi!
Quoted 2 lines
I was just about to comment on this patch when I noticed [PATCH 2/6] of a new series, which, if I'm reading it correctly replaces this patch; yes?
Yes, indeed. I should have mentioned that but ... :)
Quoted 1 line
[I have been a little tardy recently, but I do try to read all patches! ;) ]
No problems. It's why I generally wait a few days before pushing patches to the main tree.
Cheers,
-- Luc