Linux SPARSE checker discussions
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Ramsay Jones <ramsay@ramsayjones.plus.com>
Cc: linux-sparse@vger.kernel.org
Subject: Re: [PATCH v2 2/8] builtin: define a symbol_op for a generic op acting on integer
Date: Tue, 13 Apr 2021 18:42:41 +0200	[thread overview]
Message-ID: <20210413164241.wtmzkgdkyqjusova@mail> (raw)
In-Reply-To: <6d23e861-782e-de66-7ce7-76ff149d4a60@ramsayjones.plus.com>

On Tue, Apr 13, 2021 at 01:23:00AM +0100, Ramsay Jones wrote:
> On 12/04/2021 22:21, Luc Van Oostenryck wrote:
> > +	int n = 0;
> > +
> > +	PREPARE_PTR_LIST(fntype->arguments, t);
> > +	FOR_EACH_PTR(expr->args, arg) {
> 
> Hmm, now n is always 0 in the error message, so:
> 		n++;
> here?

Hehe, yes indeed.
 
> > +		if (!is_dynamic_type(t)) {
> > +			;
> > +		} else if (!ctype) {
> > +			// fist 'dynamic' type, chat that it is an integer
> 
> s/chat/check/

fixed.

> > +	return evaluate_arguments(types, expr->args);
> 
> Hmm, does this do the usual argument promotions, so e.g. an 'generic'
> 'short' gets promoted to 'int' in the prototype? I guess not, that
> would have to be done above, while adding to the types list, right?

Well, evaluate_arguments() is the normal function used to evaluate
the arguments of all function calls, so, yes, it does arguments
promotion but only when the type is not specified (so either the
'...' of varadic function or an argument of a variadic builtin's
which is declared as NULL in the corresponding struct builtin_fn
(non-variadic builtins can't have such NULL arguments because the
first NULL is used to determine its arity and this is then normaly
checked in the .args method before the evaluation)).

> Hmm, I would have to study evaluate_arguments(), but it may be worth
> a comment here?

Not here, because there is nothing special but sure, evaluate_arguments()
should be documented and even more so how struct builtin_fn should be
used (because it's much more complex since a lot of builtins doesn't
follow the way normal C declarations rules).

> 
> So, this certainly looks better. Thanks! ;-)

Thanks to you!
-- Luc

  reply	other threads:[~2021-04-13 16:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-12 21:21 [PATCH v2 0/8] scheck: add a symbolic checker Luc Van Oostenryck
2021-04-12 21:21 ` [PATCH v2 1/8] export declare_builtins() Luc Van Oostenryck
2021-04-12 21:21 ` [PATCH v2 2/8] builtin: define a symbol_op for a generic op acting on integer Luc Van Oostenryck
2021-04-13  0:23   ` Ramsay Jones
2021-04-13 16:42     ` Luc Van Oostenryck [this message]
2021-04-12 21:21 ` [PATCH v2 3/8] .gitignore is a bit too greedy Luc Van Oostenryck
2021-04-12 21:21 ` [PATCH v2 4/8] scheck: add a symbolic checker Luc Van Oostenryck
2021-04-12 21:21 ` [PATCH v2 5/8] scheck: assert_eq() Luc Van Oostenryck
2021-04-12 21:21 ` [PATCH v2 6/8] scheck: allow multiple assertions Luc Van Oostenryck
2021-04-12 21:21 ` [PATCH v2 7/8] scheck: assert_const() Luc Van Oostenryck
2021-04-12 21:21 ` [PATCH v2 8/8] scheck: support pre-conditions via __assume() Luc Van Oostenryck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210413164241.wtmzkgdkyqjusova@mail \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=ramsay@ramsayjones.plus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox