Always allow ({ }) in the ctrl-expr of _Generic
commitf85b1e393f9f32c04e9fa1e870d4ee759d2089e9
authorPetr Skocik <pskocik@gmail.com>
Tue, 13 Nov 2018 11:51:16 +0000 (13 12:51 +0100)
committerPetr Skocik <pskocik@gmail.com>
Tue, 13 Nov 2018 11:51:16 +0000 (13 12:51 +0100)
tree35f4ff15ecb9f2a54b072c9b54e44b03bfb69b6f
parent1e2e5671f7421d9915bfbaab3b0084a7fb092a7d
Always allow ({ }) in the ctrl-expr of _Generic

tcc would reject e.g.,
    void f(){ struct {_Bool x:_Generic(({0;}),default:1);} my_x; }
with `expected constant`. This patch makes it accept it.

(The patch also makes tcc's _Generic a little more "generic" than that
 of gcc and clang in that that tcc now also accepts
`struct {_Bool x:_Generic(({0;}),default:1);} my_x;` in file scope
while gcc and clang don't, but I think there's no harm in that
and gcc and clang might as well accept it in filescope too, given
that they have no problem with
e.g., `/*filescope:*/int x=1, y=2, z=_Generic(x+y, int:3);`)
tccgen.c
tests/tests2/94_generic.c