All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cleanup: remove evaluate_arguments()'s unused argument
@ 2016-11-02 17:16 Luc Van Oostenryck
  2016-11-17  9:57 ` Christopher Li
  0 siblings, 1 reply; 4+ messages in thread
From: Luc Van Oostenryck @ 2016-11-02 17:16 UTC (permalink / raw)
  To: linux-sparse; +Cc: Christopher Li, Luc Van Oostenryck

Was slightly confusing when reading some code.
Better to remove it.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 evaluate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/evaluate.c b/evaluate.c
index e350c0c0..b45a3958 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -2172,7 +2172,7 @@ static struct symbol *evaluate_alignof(struct expression *expr)
 	return size_t_ctype;
 }
 
-static int evaluate_arguments(struct symbol *f, struct symbol *fn, struct expression_list *head)
+static int evaluate_arguments(struct symbol *fn, struct expression_list *head)
 {
 	struct expression *expr;
 	struct symbol_list *argument_types = fn->arguments;
@@ -2885,7 +2885,7 @@ static struct symbol *evaluate_call(struct expression *expr)
 		if (!sym->op->args(expr))
 			return NULL;
 	} else {
-		if (!evaluate_arguments(sym, ctype, arglist))
+		if (!evaluate_arguments(ctype, arglist))
 			return NULL;
 		args = expression_list_size(expr->args);
 		fnargs = symbol_list_size(ctype->arguments);
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] cleanup: remove evaluate_arguments()'s unused argument
  2016-11-02 17:16 [PATCH] cleanup: remove evaluate_arguments()'s unused argument Luc Van Oostenryck
@ 2016-11-17  9:57 ` Christopher Li
  2016-11-17 11:13   ` Luc Van Oostenryck
  0 siblings, 1 reply; 4+ messages in thread
From: Christopher Li @ 2016-11-17  9:57 UTC (permalink / raw)
  To: Luc Van Oostenryck; +Cc: Linux-Sparse

On Thu, Nov 3, 2016 at 1:16 AM, Luc Van Oostenryck
<luc.vanoostenryck@gmail.com> wrote:
> Was slightly confusing when reading some code.
> Better to remove it.
>
> @@ -2885,7 +2885,7 @@ static struct symbol *evaluate_call(struct expression *expr)
>                 if (!sym->op->args(expr))
>                         return NULL;
>         } else {
> -               if (!evaluate_arguments(sym, ctype, arglist))
> +               if (!evaluate_arguments(ctype, arglist))
>                         return NULL;

I think this is more or less fine, even though sym is not currently
used in evaluate_arguments().
ctype contain the function declare which usually is in a line earlier
than the call expression.
The "sym" argument in the most common case contain the symbol node,
the ctype contain
the base function type.

One case might be useful for "exvaluate_arguments" to use symbol node
is to output
the beginning position of the call expression. The "fn" symbol point
to the previous line
and arglist in the later part of the expression.

As I said, the node argument is currently not used. If you feel
strongly about it
I am fine with removing it as well.

Or maybe change it to "node" instead of "f", will that be better to understand?

Chris

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cleanup: remove evaluate_arguments()'s unused argument
  2016-11-17  9:57 ` Christopher Li
@ 2016-11-17 11:13   ` Luc Van Oostenryck
  2016-11-17 16:27     ` Christopher Li
  0 siblings, 1 reply; 4+ messages in thread
From: Luc Van Oostenryck @ 2016-11-17 11:13 UTC (permalink / raw)
  To: Christopher Li; +Cc: Linux-Sparse

On Thu, Nov 17, 2016 at 05:57:52PM +0800, Christopher Li wrote:
> On Thu, Nov 3, 2016 at 1:16 AM, Luc Van Oostenryck
> <luc.vanoostenryck@gmail.com> wrote:
> > Was slightly confusing when reading some code.
> > Better to remove it.
> >
> > @@ -2885,7 +2885,7 @@ static struct symbol *evaluate_call(struct expression *expr)
> >                 if (!sym->op->args(expr))
> >                         return NULL;
> >         } else {
> > -               if (!evaluate_arguments(sym, ctype, arglist))
> > +               if (!evaluate_arguments(ctype, arglist))
> >                         return NULL;
> 
> I think this is more or less fine, even though sym is not currently
> used in evaluate_arguments().
> ctype contain the function declare which usually is in a line earlier
> than the call expression.
> The "sym" argument in the most common case contain the symbol node,
> the ctype contain
> the base function type.
> 
> One case might be useful for "exvaluate_arguments" to use symbol node
> is to output
> the beginning position of the call expression. The "fn" symbol point
> to the previous line
> and arglist in the later part of the expression.
> 
> As I said, the node argument is currently not used. If you feel
> strongly about it
> I am fine with removing it as well.

Not much important to me, but said above, it's confusing: two args,
one called 'f', the other one 'fn' and one of them is unused ...

> Or maybe change it to "node" instead of "f", will that be better to understand?
Not much I think, 'node' has even less meaning to me than 'f'or 'fn'.
Better then to focus on the (potential) purpose of this arg.
If it's for the position, maybe pass only sym->pos.

But again, it's not important at all. Let not waste our time on it.

Luc

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cleanup: remove evaluate_arguments()'s unused argument
  2016-11-17 11:13   ` Luc Van Oostenryck
@ 2016-11-17 16:27     ` Christopher Li
  0 siblings, 0 replies; 4+ messages in thread
From: Christopher Li @ 2016-11-17 16:27 UTC (permalink / raw)
  To: Luc Van Oostenryck; +Cc: Linux-Sparse

On Thu, Nov 17, 2016 at 7:13 PM, Luc Van Oostenryck
<luc.vanoostenryck@gmail.com> wrote:

>
> Not much important to me, but said above, it's confusing: two args,
> one called 'f', the other one 'fn' and one of them is unused ...

Points taken.

>
>> Or maybe change it to "node" instead of "f", will that be better to understand?
> Not much I think, 'node' has even less meaning to me than 'f'or 'fn'.
> Better then to focus on the (potential) purpose of this arg.
> If it's for the position, maybe pass only sym->pos.

OK. I will just apply the patch. We can always add the argument back
if there is a real need for it.

Chris

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-11-17 17:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-02 17:16 [PATCH] cleanup: remove evaluate_arguments()'s unused argument Luc Van Oostenryck
2016-11-17  9:57 ` Christopher Li
2016-11-17 11:13   ` Luc Van Oostenryck
2016-11-17 16:27     ` Christopher Li

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.