On Mon, Nov 30, 2015 at 07:01:23AM -0500, Frediano Ziglio wrote: > Nacked! > > Believe or not this seems to not work! > > I added this code in quic.c > > spice_static_assert (evol == 500); > > which is surely wrong... and it's compiling !!! > > Than I tried to get code using > > #define BBB(s) #s > #define AAA(s) BBB(s) > printf("%s\n", AAA(spice_static_assert (evol == 500))); > > and I'm getting > > typedef char _GStaticAssertCompileTimeAssertion_2[(evol == 500) ? 1 : -1] __attribute__((__unused__)) > > I'm using Fedora 22 compiler. > > I'm quite surprised! This is explained in verify.h actually « One might think that an array size check would have the same effect, that is, that the type struct { unsigned int dummy[W]; } would work as well. However, inside a function, some compilers (such as C++ compilers and GNU C) allow local parameters and variables inside array size expressions. With these compilers, an array size check would not properly diagnose this misuse of the verify macro: void function (int n) { verify (n < 0); } » I filed https://bugzilla.gnome.org/show_bug.cgi?id=758844 for it. I can change this to use verify.h rather than G_STATIC_ASSERT. The places where we are currently using spice_static_assert() would not really be impacted by that though. One place needs to change (in quic.c) as the static assert should be a spice_assert(). Christophe
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel