* [PATCH] inline: avoid node of node on variadics
@ 2022-06-25 22:14 Luc Van Oostenryck
2022-06-26 14:38 ` Ramsay Jones
0 siblings, 1 reply; 3+ messages in thread
From: Luc Van Oostenryck @ 2022-06-25 22:14 UTC (permalink / raw)
To: linux-sparse; +Cc: Luc Van Oostenryck
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
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 <luc.vanoostenryck@gmail.com>
---
inline.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/inline.c b/inline.c
index 0097e4bf620a..4ee44eedec7a 100644
--- a/inline.c
+++ b/inline.c
@@ -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);
--
2.36.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] inline: avoid node of node on variadics
2022-06-25 22:14 [PATCH] inline: avoid node of node on variadics Luc Van Oostenryck
@ 2022-06-26 14:38 ` Ramsay Jones
2022-06-26 16:04 ` Luc Van Oostenryck
0 siblings, 1 reply; 3+ messages in thread
From: Ramsay Jones @ 2022-06-26 14:38 UTC (permalink / raw)
To: Luc Van Oostenryck, linux-sparse; +Cc: Luc Van Oostenryck
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
On 25/06/2022 23:14, Luc Van Oostenryck wrote:
> From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
>
> 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 <luc.vanoostenryck@gmail.com>
> ---
> inline.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/inline.c b/inline.c
> index 0097e4bf620a..4ee44eedec7a 100644
> --- a/inline.c
> +++ b/inline.c
> @@ -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);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] inline: avoid node of node on variadics
2022-06-26 14:38 ` Ramsay Jones
@ 2022-06-26 16:04 ` Luc Van Oostenryck
0 siblings, 0 replies; 3+ messages in thread
From: Luc Van Oostenryck @ 2022-06-26 16:04 UTC (permalink / raw)
To: Ramsay Jones; +Cc: Luc Van Oostenryck, linux-sparse
On Sun, Jun 26, 2022 at 03:38:22PM +0100, Ramsay Jones wrote:
> Hi Luc,
Hi!
> 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 ... :)
> [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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-26 16:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-25 22:14 [PATCH] inline: avoid node of node on variadics Luc Van Oostenryck
2022-06-26 14:38 ` Ramsay Jones
2022-06-26 16:04 ` Luc Van Oostenryck
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.