[Mesa-dev] [PATCH] st/nine: correctly fold guards around define WINAPI

Emil Velikov emil.l.velikov at gmail.com
Fri Apr 15 15:06:53 UTC 2016


From: Emil Velikov <emil.velikov at collabora.com>

The __i386__ and __x86-64__ macros are gcc/clang specific, thus one does
not need the __GNUC__ at the top.

Additionally, having _M_IX86 and _M_X64 in the same block (and even use
__attribute__(foo)) is wrong as those are set by MSVC.

If at some point we do start building with the Sun/Oracle compiler we
might need to add the __i386 and __x86-64 and explicit checks for
__attribute__(foo) as the latter is not something that exists there.

Cc: Christian Schmidbauer <ch.schmidbauer at gmail.com>
Cc: Axel Davy <axel.davy at ens.fr>
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
 include/D3D9/d3d9types.h | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/include/D3D9/d3d9types.h b/include/D3D9/d3d9types.h
index dce5533..bcce061 100644
--- a/include/D3D9/d3d9types.h
+++ b/include/D3D9/d3d9types.h
@@ -178,15 +178,13 @@ typedef struct _RGNDATA {
 #undef WINAPI
 #endif /* WINAPI*/
 
-#ifdef __GNUC__
-  #if (defined(__x86_64__) && !defined(__ILP32__)) || defined(_M_X64)
-    #define WINAPI __attribute__((ms_abi))
-  #elif defined(__i386) || defined(_M_IX86)
-    #define WINAPI __attribute__((__stdcall__))
-  #else /* neither amd64 nor i386 */
-    #define WINAPI
-  #endif
-#else /* __GNUC__ */
+#if defined(__x86_64__) && !defined(__ILP32__)
+  #define WINAPI __attribute__((ms_abi))
+#elif defined(__i386__)
+  #define WINAPI __attribute__((__stdcall__))
+#elif defined(_M_IX86) /* MSVC specific, do we even use it ? */
+  #define WINAPI
+#elif defined(_M_X64) /* MSVC specific, do we even use it ? */
   #define WINAPI
 #endif
 
-- 
2.6.2



More information about the mesa-dev mailing list