mesa/glsl: Move string_to_uint_map into the util folder
[mesa.git] / src / util / macros.h
index 0c8958feae9b1b83a10d446e4c5e92b1d0429683..9ddf675965b4e53e2f51a62707077818de34f2a4 100644 (file)
@@ -26,6 +26,8 @@
 
 #include <assert.h>
 
+#include "c99_compat.h"
+
 /* Compute the size of an array */
 #ifndef ARRAY_SIZE
 #  define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
@@ -152,6 +154,12 @@ do {                       \
 #define ATTRIBUTE_PURE
 #endif
 
+#ifdef HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL
+#define ATTRIBUTE_RETURNS_NONNULL __attribute__((__returns_nonnull__))
+#else
+#define ATTRIBUTE_RETURNS_NONNULL
+#endif
+
 #ifdef __cplusplus
 /**
  * Macro function that evaluates to true if T is a trivially
@@ -204,12 +212,20 @@ do {                       \
 #define UNUSED
 #endif
 
+#define MAYBE_UNUSED UNUSED
+
 #ifdef HAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT
 #define MUST_CHECK __attribute__((warn_unused_result))
 #else
 #define MUST_CHECK
 #endif
 
+#if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+#define ATTRIBUTE_NOINLINE __attribute__((noinline))
+#else
+#define ATTRIBUTE_NOINLINE
+#endif
+
 /** Compute ceiling of integer quotient of A divided by B. */
 #define DIV_ROUND_UP( A, B )  ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 )