aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/compiler.h
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main/compiler.h')
-rw-r--r--mesalib/src/mesa/main/compiler.h110
1 files changed, 2 insertions, 108 deletions
diff --git a/mesalib/src/mesa/main/compiler.h b/mesalib/src/mesa/main/compiler.h
index 79d8740e5..35160223e 100644
--- a/mesalib/src/mesa/main/compiler.h
+++ b/mesalib/src/mesa/main/compiler.h
@@ -44,6 +44,8 @@
#include <float.h>
#include <stdarg.h>
+#include "util/macros.h"
+
#include "c99_compat.h" /* inline, __func__, etc. */
@@ -130,23 +132,6 @@ extern "C" {
#endif
-/**
- * __builtin_expect macros
- */
-#if !defined(__GNUC__)
-# define __builtin_expect(x, y) (x)
-#endif
-
-#ifndef likely
-# 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
-#endif
-
/* XXX: Use standard `__func__` instead */
#ifndef __FUNCTION__
# define __FUNCTION__ __func__
@@ -238,65 +223,16 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
#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 { \
- (void) sizeof(char [1 - 2*!(COND)]); \
- } while (0)
-
-/**
- * Unreachable macro. Useful for suppressing "control reaches end of non-void
- * function" warnings.
- */
-#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 5
-#define unreachable(str) \
-do { \
- assert(!str); \
- __builtin_unreachable(); \
-} while (0)
-#elif (defined(__clang__) && defined(__has_builtin))
-# if __has_builtin(__builtin_unreachable)
-# define unreachable(str) \
-do { \
- assert(!str); \
- __builtin_unreachable(); \
-} while (0)
-# endif
-#endif
-
-#ifndef unreachable
-#define unreachable(str)
-#endif
-
/*
* A trick to suppress uninitialized variable warning without generating any
* code
*/
#define uninitialized_var(x) x = x
-#if (__GNUC__ >= 3)
-#define PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a)))
-#else
-#define PRINTFLIKE(f, a)
-#endif
-
#ifndef NULL
#define NULL 0
#endif
-/* Used to optionally mark structures with misaligned elements or size as
- * packed, to trade off performance for space.
- */
-#if (__GNUC__ >= 3)
-#define PACKED __attribute__((__packed__))
-#else
-#define PACKED
-#endif
-
/**
* LONGSTRING macro
@@ -329,25 +265,7 @@ do { \
#define FLT_MAX_EXP 128
#endif
-
-/**
- * USE_IEEE: Determine if we're using IEEE floating point
- */
-#if defined(__i386__) || defined(__386__) || defined(__sparc__) || \
- defined(__s390__) || defined(__s390x__) || defined(__powerpc__) || \
- defined(__x86_64__) || \
- defined(__m68k__) || \
- defined(ia64) || defined(__ia64__) || \
- defined(__hppa__) || defined(hpux) || \
- defined(__mips) || defined(_MIPS_ARCH) || \
- defined(__arm__) || defined(__aarch64__) || \
- defined(__sh__) || defined(__m32r__) || \
- (defined(__sun) && defined(_IEEE_754)) || \
- defined(__alpha__)
-#define USE_IEEE
#define IEEE_ONE 0x3f800000
-#endif
-
/**
* START/END_FAST_MATH macros:
@@ -433,30 +351,6 @@ do { \
#endif
#ifdef __cplusplus
-/**
- * Macro function that evaluates to true if T is a trivially
- * destructible type -- that is, if its (non-virtual) destructor
- * performs no action and all member variables and base classes are
- * trivially destructible themselves.
- */
-# if defined(__GNUC__)
-# if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
-# define HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
-# endif
-# elif (defined(__clang__) && defined(__has_feature))
-# if __has_feature(has_trivial_destructor)
-# define HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
-# endif
-# endif
-# ifndef HAS_TRIVIAL_DESTRUCTOR
- /* It's always safe (if inefficient) to assume that a
- * destructor is non-trivial.
- */
-# define HAS_TRIVIAL_DESTRUCTOR(T) (false)
-# endif
-#endif
-
-#ifdef __cplusplus
}
#endif