Message ID | 20161102171623.17883-1-luc.vanoostenryck@gmail.com (mailing list archive) |
---|---|
State | Mainlined, archived |
Headers | show |
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 -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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 -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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 -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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);
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(-)