Quantcast
Channel: lkml.org : Shesha Sreenivasamurthy
Viewing all articles
Browse latest Browse all 1267

Re: [PATCH v5 0/2] Remove false-positive VLAs when using max()

$
0
0
Linus Torvalds writes: (Summary) wrote:

[...]

=E2=80=99:

[...]

=E2=80=98__builtin_choose_expr=E2=80=99 not a constant Ok, so it really looks like that same "__builtin_constant_p() doesn't return a constant".
return a constant".
Which is really odd, but there you have it.
Which is really odd, but there you have it.
I wonder if you can use that "sizeof()" to force evaluation of it, because sizeof() really does end up being magical when it comes to "integer constant expression".
"integer constant expression".
So instead of this:
So instead of this:
#define __no_side_effects(a,b) \
(__builtin_constant_p(a)&&__builtin_constant_p(b)) (__builtin_constant_p(a)&&__builtin_constant_p(b)) that just assumes that __builtin_constant_p() itself always counts as a constant expression, what happens if you do
a constant expression, what happens if you do
#define __is_constant(a) \
(sizeof(char[__builtin_constant_p(a)]))

Viewing all articles
Browse latest Browse all 1267

Trending Articles