[Mesa-dev] [PATCH] util: move ALWAYS_INLINE macro to util/macro.h
Nicolai Hähnle
nhaehnle at gmail.com
Mon May 8 10:13:49 UTC 2017
On 08.05.2017 00:01, Timothy Arceri wrote:
> Also added clang check.
>
> macro.h is include by p_compiler.h so no other change is needed.
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
> ---
> src/gallium/include/pipe/p_compiler.h | 11 -----------
> src/util/macros.h | 11 +++++++++++
> 2 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h
> index 0d7b014..2869517 100644
> --- a/src/gallium/include/pipe/p_compiler.h
> +++ b/src/gallium/include/pipe/p_compiler.h
> @@ -86,31 +86,20 @@ typedef unsigned char boolean;
> #endif
>
> #ifndef va_copy
> #ifdef __va_copy
> #define va_copy(dest, src) __va_copy((dest), (src))
> #else
> #define va_copy(dest, src) (dest) = (src)
> #endif
> #endif
>
> -/* Forced function inlining */
> -#ifndef ALWAYS_INLINE
> -# ifdef __GNUC__
> -# define ALWAYS_INLINE inline __attribute__((always_inline))
> -# elif defined(_MSC_VER)
> -# define ALWAYS_INLINE __forceinline
> -# else
> -# define ALWAYS_INLINE inline
> -# endif
> -#endif
> -
>
> /* XXX: Use standard `__func__` instead */
> #ifndef __FUNCTION__
> # define __FUNCTION__ __func__
> #endif
>
>
> /* This should match linux gcc cdecl semantics everywhere, so that we
> * just codegen one calling convention on all platforms.
> */
> diff --git a/src/util/macros.h b/src/util/macros.h
> index 6f55ac6..a10f1de 100644
> --- a/src/util/macros.h
> +++ b/src/util/macros.h
> @@ -129,20 +129,31 @@ do { \
> #else
> #define PRINTFLIKE(f, a)
> #endif
>
> #ifdef HAVE_FUNC_ATTRIBUTE_MALLOC
> #define MALLOCLIKE __attribute__((__malloc__))
> #else
> #define MALLOCLIKE
> #endif
>
> +/* Forced function inlining */
> +#ifndef ALWAYS_INLINE
> +# if defined(__GNUC__) || defined(__clang__)
> +# define ALWAYS_INLINE inline __attribute__((always_inline))
> +# elif defined(_MSC_VER)
> +# define ALWAYS_INLINE __forceinline
> +# else
> +# define ALWAYS_INLINE inline
> +# endif
> +#endif
> +
> /* Used to optionally mark structures with misaligned elements or size as
> * packed, to trade off performance for space.
> */
> #ifdef HAVE_FUNC_ATTRIBUTE_PACKED
> #define PACKED __attribute__((__packed__))
> #else
> #define PACKED
> #endif
>
> /* Attribute pure is used for functions that have no effects other than their
>
--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
More information about the mesa-dev
mailing list