X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Futil%2Fmacros.h;h=9ddf675965b4e53e2f51a62707077818de34f2a4;hb=690ead4a135aed68ddb8dcfceccd11adf27ff1f1;hp=0c8958feae9b1b83a10d446e4c5e92b1d0429683;hpb=d5c9955d3eaa7311e2b2350b6964bae516c7b7b2;p=mesa.git diff --git a/src/util/macros.h b/src/util/macros.h index 0c8958feae9..9ddf675965b 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -26,6 +26,8 @@ #include +#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 )