From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Nicolai Stange <nicstange@gmail.com>
Cc: linux-sparse@vger.kernel.org
Subject: Re: [PATCH RFC 01/13] expression: introduce additional expression constness tracking flags
Date: Mon, 11 Jan 2016 18:54:31 +0100 [thread overview]
Message-ID: <20160111175430.GC2972@macpro.local> (raw)
In-Reply-To: <87a8oewg2c.fsf@gmail.com>
On Sat, Jan 09, 2016 at 11:20:27PM +0100, Nicolai Stange wrote:
> Luc Van Oostenryck <luc.vanoostenryck@gmail.com> writes:
> >
> > Shouldn't the following be more explicit?
> > flag = expr_set_flag_mask(0, ...);
> > flag = expr_set_flag_mask(in_flag, ...);
> > flag = expr_clear_flag_mask(in_flag, ...);
> > Yes, I know, it would need to duplicate the expr->flags at almost all calls.
>
> Admittedly, this looks way better.
>
> I'll change that to
> void expr_set_flag(unsigned *flag, ...);
> and likewise for the clearing guy.
>
> >
> > Couldn't we get rid of those two function by separating the exclusive "bits"
> > from the "sets"?
> > Something like:
> > #define __EXPR_FLAG_INT_CONST (1 << 0)
> > #define __EXPR_FLAG_FP_CONST (1 << 1)
> > ...
> > #define EXPR_FLAG_INT_CONST (__EXPR_FLAG_INT_CONST |
> > __EXPR_FLAG_INT_CONST_EXPR |
> > __EXPR_FLAG_ARITH_CONST)
>
> No, this won't work since the "implied" bit masks are in general different for
> setting and clearing a flag.
>
> For example, "integer constant" (i.e. integer literal) implies "integer
> constant expression", but "not a integer constant" does not imply "not a
> integer constant expression".
Yes, sure, but it could work with one set of such macro to add flags
and another one to clear them.
I think it would be more clear and would avoid the need to have the two
helper above.
Not that it is critical, though.
Yours,
Luc
prev parent reply other threads:[~2016-01-11 17:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-22 23:11 [PATCH RFC 01/13] expression: introduce additional expression constness tracking flags Nicolai Stange
2015-08-01 13:00 ` Sam Ravnborg
2016-01-09 17:03 ` Luc Van Oostenryck
2016-01-09 22:20 ` Nicolai Stange
2016-01-11 17:54 ` Luc Van Oostenryck [this message]
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=20160111175430.GC2972@macpro.local \
--to=luc.vanoostenryck@gmail.com \
--cc=linux-sparse@vger.kernel.org \
--cc=nicstange@gmail.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;
as well as URLs for NNTP newsgroup(s).