C_ASSERT portability fixes and simplification [PATCH 1/2]

Gerald Pfeifer gerald at pfeifer.com
Wed May 13 00:31:22 CDT 2009


On Mon, 11 May 2009, Alexandre Julliard wrote:
> I don't have gcc 4.5 to test this, but you could try using a function
> instead, something like this:
> 
> diff --git a/include/winnt.h b/include/winnt.h
> index abcc502..aaa4112 100644
> --- a/include/winnt.h
> +++ b/include/winnt.h
> @@ -292,7 +292,7 @@ extern "C" {
>  #if defined(_MSC_VER)
>  # define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
>  #elif defined(__GNUC__) 
> -# define C_ASSERT(e) extern char __C_ASSERT__[(e)?1:-1] __attribute__((unused))
> +# define C_ASSERT(e) extern void __C_ASSERT__(int [(e)?1:-1])
>  #else
>  # define C_ASSERT(e)
>  #endif

You are a clever man, Sir! :-)

It took me a bit, since incidently the GCC 4.5 development tree was
broken wrt. Wine on Monday (I reported this bug upstream), but a
build with your patch went through both with GCC 4.2.1 and GCC 4.5.0 
(experimental) tonight.

I assume you will commit this now?

Thanks,
Gerald



More information about the wine-devel mailing list