[Mesa-dev] [PATCH 5/6] mesa: replace _ASMAPI with __cdecl

Matt Turner mattst88 at gmail.com
Tue Mar 10 21:50:21 PDT 2015


On Tue, Mar 10, 2015 at 6:44 PM, Brian Paul <brianp at vmware.com> wrote:
> __cdecl is the MSVC directive use to indicate caller stack cleanup.
> We typically annotate code-generated functions with __cdecl so we can
> use the same code on all platforms.
>
> A new #define like CDECL would be nicer, but CDECL is already defined
> in minwindef.h on Windows.
> ---
>  src/mesa/main/compiler.h    | 13 ++++------
>  src/mesa/math/m_clip_tmp.h  |  8 +++----
>  src/mesa/math/m_norm_tmp.h  | 18 +++++++-------
>  src/mesa/math/m_xform.h     |  6 ++---
>  src/mesa/math/m_xform_tmp.h | 58 ++++++++++++++++++++++-----------------------
>  src/mesa/swrast/s_blend.c   | 18 +++++++-------
>  src/mesa/swrast/s_context.c |  2 +-
>  src/mesa/swrast/s_context.h |  2 +-
>  src/mesa/x86/3dnow.c        |  6 ++---
>  src/mesa/x86/common_x86.c   | 12 +++++-----
>  src/mesa/x86/mmx.h          | 10 ++++----
>  src/mesa/x86/sse.c          | 20 ++++++++--------
>  src/mesa/x86/x86_xform.c    |  8 +++----
>  src/mesa/x86/x86_xform.h    | 30 +++++++++++------------
>  14 files changed, 104 insertions(+), 107 deletions(-)
>
> diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
> index 1e97b4c..f56dc3e 100644
> --- a/src/mesa/main/compiler.h
> +++ b/src/mesa/main/compiler.h
> @@ -115,18 +115,15 @@ extern "C" {
>
>
>  /**
> - * Create a macro so that asm functions can be linked into compilers other
> - * than GNU C
> + * Use __cdecl to match gcc calling convention for caller stack cleanup
> + * so we can use the same assembly / codegen code on all platforms.
>   */
> -#ifndef _ASMAPI
> -#if defined(_WIN32)
> -#define _ASMAPI __cdecl
> -#else
> -#define _ASMAPI
> -#endif
> +#if !defined(_MSC_VER)
> +#define __cdecl
>  #endif
>
>
> +

Stray newline.
>  /**
>   * LONGSTRING macro
>   * gcc -pedantic warns about long string literals, LONGSTRING silences that.


More information about the mesa-dev mailing list