C_ASSERT portability fixes and simplification [PATCH 1/2]

Alexandre Julliard julliard at winehq.org
Mon May 11 07:55:56 CDT 2009


Gerald Pfeifer <gerald at pfeifer.com> writes:

> The current implementation doesn't work with GCC 4.5 (or ISO C)
> and I failed to find any other way. :-(  
>
> Your point on this being autogenerated clearly is strong one --
> either we need to change that generation or find a different way
> to implement C_ASSERT.
>
> Any idea how to best approach this?

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

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list