X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmesa%2Fmain%2Fcompiler.h;h=5557a3b5cb5ac4ffd804bb27d84ee22d389dc6c6;hb=f29606598e7703d830440a878673d98e7ce13218;hp=9cef99f67a53a08d3913f473a79cd06ab264e242;hpb=cd8614b0287dc5a69725ec4ee0208fad61f7789e;p=mesa.git diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h index 9cef99f67a5..5557a3b5cb5 100644 --- a/src/mesa/main/compiler.h +++ b/src/mesa/main/compiler.h @@ -65,9 +65,7 @@ extern "C" { typedef unsigned __int8 uint8_t; typedef __int16 int16_t; typedef unsigned __int16 uint16_t; -# ifndef __eglplatform_h_ - typedef __int32 int32_t; -# endif + typedef __int32 int32_t; typedef unsigned __int32 uint32_t; typedef __int64 int64_t; typedef unsigned __int64 uint64_t; @@ -173,8 +171,7 @@ extern "C" { * We also need to define a USED attribute, so the optimizer doesn't * inline a static function that we later use in an alias. - ajax */ -#if (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303) \ - || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) +#if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) # define PUBLIC __attribute__((visibility("default"))) # define USED __attribute__((used)) #else @@ -197,10 +194,17 @@ extern "C" { /** * __builtin_expect macros */ -#if (!defined(__GNUC__) || __GNUC__ < 3) && (!defined(__IBMC__) || __IBMC__ < 900) +#if !defined(__GNUC__) # define __builtin_expect(x, y) x #endif +#ifdef __GNUC__ +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) +#else +#define likely(x) !!(x) +#define unlikely(x) !!(x) +#endif /** * The __FUNCTION__ gcc variable is generally only used for debugging. @@ -210,7 +214,7 @@ extern "C" { #ifndef __FUNCTION__ # if defined(__VMS) # define __FUNCTION__ "VMS$NL:" -# elif ((!defined __GNUC__) || (__GNUC__ < 2)) && (!defined __xlC__) && \ +# elif !defined(__GNUC__) && !defined(__xlC__) && \ (!defined(_MSC_VER) || _MSC_VER < 1300) # if (__STDC_VERSION__ >= 199901L) /* C99 */ || \ (defined(__SUNPRO_C) && defined(__C99FEATURES__)) @@ -220,6 +224,18 @@ extern "C" { # endif # endif #endif +#ifndef __func__ +# if (__STDC_VERSION__ >= 199901L) || \ + (defined(__SUNPRO_C) && defined(__C99FEATURES__)) + /* __func__ is part of C99 */ +# elif defined(_MSC_VER) +# if _MSC_VER >= 1300 +# define __func__ __FUNCTION__ +# else +# define __func__ "" +# endif +# endif +#endif /** @@ -312,6 +328,11 @@ static INLINE GLuint CPU_TO_LE32(GLuint x) #endif #endif +#if (__GNUC__ >= 3) +#define PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a))) +#else +#define PRINTFLIKE(f, a) +#endif #ifndef NULL #define NULL 0 @@ -322,8 +343,7 @@ static INLINE GLuint CPU_TO_LE32(GLuint x) * LONGSTRING macro * gcc -pedantic warns about long string literals, LONGSTRING silences that. */ -#if !defined(__GNUC__) || (__GNUC__ < 2) || \ - ((__GNUC__ == 2) && (__GNUC_MINOR__ <= 7)) +#if !defined(__GNUC__) # define LONGSTRING #else # define LONGSTRING __extension__ @@ -338,6 +358,10 @@ static INLINE GLuint CPU_TO_LE32(GLuint x) #define M_E (2.7182818284590452354) #endif +#ifndef M_LOG2E +#define M_LOG2E (1.4426950408889634074) +#endif + #ifndef ONE_DIV_LN2 #define ONE_DIV_LN2 (1.442695040888963456) #endif