Re: [spice-common 3/7] log: Use G_STATIC_ASSERT for spice_static_assert implementation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> This is better than the runtime assertion we had.
> ---
>  common/log.h | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/common/log.h b/common/log.h
> index 75daa56..3378e2a 100644
> --- a/common/log.h
> +++ b/common/log.h
> @@ -131,11 +131,8 @@ void spice_log(const char *log_domain,
>  } G_STMT_END
>  #endif
>  
> -/* FIXME: improve that some day.. */
>  #ifndef spice_static_assert
> -#define spice_static_assert(x) SPICE_STMT_START {       \
> -    spice_assert(x);                                    \
> -} SPICE_STMT_END
> +#define spice_static_assert(x) G_STATIC_ASSERT(x)
>  #endif
>  
>  SPICE_END_DECLS
> --
> 2.5.0
> 

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!

Frediano
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]