mesa: remove ARB_transpose_matrix extension enable flag
[mesa.git] / src / mesa / main / compiler.h
index ee7d0b2f88056164f76fcca4ad32c5db3bcefe1a..a8cddaf8fd74f6ff4be0a2219f9adaa45f4e2085 100644 (file)
@@ -45,9 +45,6 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#if defined(__linux__) && defined(__i386__)
-#include <fpu_control.h>
-#endif
 #include <float.h>
 #include <stdarg.h>
 
@@ -93,7 +90,7 @@ extern "C" {
 /**
  * Disable assorted warnings
  */
-#if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) && !defined(BUILD_FOR_SNAP)
+#if !defined(OPENSTEP) && (defined(_WIN32) && !defined(__CYGWIN__)) && !defined(BUILD_FOR_SNAP)
 #  if !defined(__GNUC__) /* mingw environment */
 #    pragma warning( disable : 4068 ) /* unknown pragma */
 #    pragma warning( disable : 4710 ) /* function 'foo' not inlined */
@@ -117,29 +114,30 @@ extern "C" {
 /**
  * Function inlining
  */
-#ifndef INLINE
-#  if defined(__GNUC__)
-#    define INLINE __inline__
-#  elif defined(__MSC__)
-#    define INLINE __inline
+#ifndef inline
+#  ifdef __cplusplus
+     /* C++ supports inline keyword */
+#  elif defined(__GNUC__)
+#    define inline __inline__
 #  elif defined(_MSC_VER)
-#    define INLINE __inline
+#    define inline __inline
 #  elif defined(__ICL)
-#    define INLINE __inline
+#    define inline __inline
 #  elif defined(__INTEL_COMPILER)
-#    define INLINE inline
+     /* Intel compiler supports inline keyword */
 #  elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100)
-#    define INLINE __inline
+#    define inline __inline
 #  elif defined(__SUNPRO_C) && defined(__C99FEATURES__)
-#    define INLINE inline
-#    define __inline inline
-#    define __inline__ inline
-#  elif (__STDC_VERSION__ >= 199901L) /* C99 */
-#    define INLINE inline
+     /* C99 supports inline keyword */
+#  elif (__STDC_VERSION__ >= 199901L)
+     /* C99 supports inline keyword */
 #  else
-#    define INLINE
+#    define inline
 #  endif
 #endif
+#ifndef INLINE
+#  define INLINE inline
+#endif
 
 
 /**
@@ -152,7 +150,7 @@ extern "C" {
  * inline a static function that we later use in an alias. - ajax
  */
 #ifndef PUBLIC
-#  if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+#  if (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
 #    define PUBLIC __attribute__((visibility("default")))
 #    define USED __attribute__((used))
 #  else
@@ -162,17 +160,6 @@ extern "C" {
 #endif
 
 
-/**
- * Some compilers don't like some of Mesa's const usage.  In those places use
- * CONST instead of const.  Pass -DNO_CONST to compilers where this matters.
- */
-#ifdef NO_CONST
-#  define CONST
-#else
-#  define CONST const
-#endif
-
-
 /**
  * __builtin_expect macros
  */
@@ -243,6 +230,9 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
            ((x & 0x00ff0000) >>  8) |
            ((x & 0xff000000) >> 24));
 }
+#elif defined(__OpenBSD__)
+#include <sys/types.h>
+#define CPU_TO_LE32( x )       htole32( x )
 #else /*__linux__ */
 #include <sys/endian.h>
 #define CPU_TO_LE32( x )       bswap32( x )
@@ -256,7 +246,7 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
 
 
 
-#if !defined(CAPI) && defined(WIN32) && !defined(BUILD_FOR_SNAP)
+#if !defined(CAPI) && defined(_WIN32) && !defined(BUILD_FOR_SNAP)
 #define CAPI _cdecl
 #endif
 
@@ -266,7 +256,7 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
  * than GNU C
  */
 #ifndef _ASMAPI
-#if defined(WIN32) && !defined(BUILD_FOR_SNAP)/* was: !defined( __GNUC__ ) && !defined( VMS ) && !defined( __INTEL_COMPILER )*/
+#if defined(_WIN32) && !defined(BUILD_FOR_SNAP)/* was: !defined( __GNUC__ ) && !defined( VMS ) && !defined( __INTEL_COMPILER )*/
 #define _ASMAPI __cdecl
 #else
 #define _ASMAPI
@@ -287,12 +277,6 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
 #endif
 
 
-/* This is a macro on IRIX */
-#ifdef _P
-#undef _P
-#endif
-
-
 /* Turn off macro checking systems used by other libraries */
 #ifdef CHECK
 #undef CHECK
@@ -312,6 +296,18 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
 #endif
 #endif
 
+
+/**
+ * Static (compile-time) assertion.
+ * Basically, use COND to dimension an array.  If COND is false/zero the
+ * array size will be -1 and we'll get a compilation error.
+ */
+#define STATIC_ASSERT(COND) \
+   do { \
+      typedef int static_assertion_failed[(!!(COND))*2-1]; \
+   } while (0)
+
+
 #if (__GNUC__ >= 3)
 #define PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a)))
 #else