diff options
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | src/util/macros.h | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index ea0f069cd31..d240c060573 100644 --- a/configure.ac +++ b/configure.ac @@ -210,6 +210,7 @@ AX_GCC_FUNC_ATTRIBUTE([format]) AX_GCC_FUNC_ATTRIBUTE([malloc]) AX_GCC_FUNC_ATTRIBUTE([packed]) AX_GCC_FUNC_ATTRIBUTE([unused]) +AX_GCC_FUNC_ATTRIBUTE([warn_unused_result]) AM_CONDITIONAL([GEN_ASM_OFFSETS], test "x$GEN_ASM_OFFSETS" = xyes) diff --git a/src/util/macros.h b/src/util/macros.h index 3b708ed6aa2..66698e72701 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -182,6 +182,12 @@ do { \ #define UNUSED #endif +#ifdef HAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT +#define MUST_CHECK __attribute__((warn_unused_result)) +#else +#define MUST_CHECK +#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 ) |