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

Grazvydas Ignotas notasas at gmail.com
Fri Apr 15 15:27:12 UTC 2016


On Fri, Apr 15, 2016 at 6:06 PM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> 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

for correctness, it should be __stdcall as MSVC defaults to C calling
convention.

GraÅžvydas


More information about the mesa-dev mailing list