X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fgallium%2Finclude%2Fpipe%2Fp_compiler.h;h=1fa3ec8300ab7d688397b0ee748d52652c0d55fe;hb=6c03c576cc49bbb008de66d374f4302ff0fe0390;hp=9b31555f1b1a89a62567e04fef8c6eebb0dad93a;hpb=a6171a9dd99713266091982215bf1008c9ac8e64;p=mesa.git diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h index 9b31555f1b1..1fa3ec8300a 100644 --- a/src/gallium/include/pipe/p_compiler.h +++ b/src/gallium/include/pipe/p_compiler.h @@ -60,6 +60,11 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + + #if !defined(__HAIKU__) && !defined(__USE_MISC) typedef unsigned int uint; typedef unsigned short ushort; @@ -97,11 +102,23 @@ typedef unsigned char boolean; # 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 /* Function visibility */ #ifndef PUBLIC # if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) # define PUBLIC __attribute__((visibility("default"))) +# elif defined(_MSC_VER) +# define PUBLIC __declspec(dllexport) # else # define PUBLIC # endif @@ -182,6 +199,25 @@ typedef unsigned char boolean; #endif + +#if defined(__GNUC__) + +#define PIPE_READ_WRITE_BARRIER() __asm__("":::"memory") + +#elif defined(_MSC_VER) + +void _ReadWriteBarrier(void); +#pragma intrinsic(_ReadWriteBarrier) +#define PIPE_READ_WRITE_BARRIER() _ReadWriteBarrier() + +#else + +#warning "Unsupported compiler" +#define PIPE_READ_WRITE_BARRIER() /* */ + +#endif + + /* You should use these macros to mark if blocks where the if condition * is either likely to be true, or unlikely to be true. * @@ -222,4 +258,10 @@ typedef unsigned char boolean; #define unlikely(x) !!(x) #endif + +#if defined(__cplusplus) +} +#endif + + #endif /* P_COMPILER_H */