Re: [Mesa-dev] [PATCH] mesa: Add a MUST_CHECK macro for __attribute__((warn_unused_result)).
On Mon, Jul 06, 2015 at 11:18:00AM -0700, Kenneth Graunke wrote: In the kernel, this is called __must_check; all our attribute macros in Mesa appear to be uppercase, so I went with that. Signed-off-by: Kenneth Graunke kenn...@whitecape.org Cc: ch...@chris-wilson.co.uk Cc: matts...@gmail.com --- configure.ac | 1 + src/util/macros.h | 6 ++ 2 files changed, 7 insertions(+) I noticed Chris wants to use this in one of his patches, so I figured I'd throw together a patch to do this a bit more cleanly. That would suit me very much. I guess I need to learn about AX_GCC_FUNC_ATTRIBUTE! Reviewed-by: Chris Wilson ch...@chris-wilson.co.uk -Chris -- Chris Wilson, Intel Open Source Technology Centre ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: Add a MUST_CHECK macro for __attribute__((warn_unused_result)).
On Monday, July 06, 2015 09:27:12 PM Chris Wilson wrote: On Mon, Jul 06, 2015 at 11:18:00AM -0700, Kenneth Graunke wrote: In the kernel, this is called __must_check; all our attribute macros in Mesa appear to be uppercase, so I went with that. Signed-off-by: Kenneth Graunke kenn...@whitecape.org Cc: ch...@chris-wilson.co.uk Cc: matts...@gmail.com --- configure.ac | 1 + src/util/macros.h | 6 ++ 2 files changed, 7 insertions(+) I noticed Chris wants to use this in one of his patches, so I figured I'd throw together a patch to do this a bit more cleanly. That would suit me very much. I guess I need to learn about AX_GCC_FUNC_ATTRIBUTE! Reviewed-by: Chris Wilson ch...@chris-wilson.co.uk -Chris It's pretty handy! Matt found it in the autoconf archive: http://www.gnu.org/software/autoconf-archive/ax_gcc_func_attribute.html We just dropped it in our m4/ directory. signature.asc Description: This is a digitally signed message part. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: Add a MUST_CHECK macro for __attribute__((warn_unused_result)).
On Mon, Jul 6, 2015 at 11:18 AM, Kenneth Graunke kenn...@whitecape.org wrote: In the kernel, this is called __must_check; all our attribute macros in Mesa appear to be uppercase, so I went with that. Signed-off-by: Kenneth Graunke kenn...@whitecape.org Cc: ch...@chris-wilson.co.uk Cc: matts...@gmail.com --- Reviewed-by: Matt Turner matts...@gmail.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa: Add a MUST_CHECK macro for __attribute__((warn_unused_result)).
In the kernel, this is called __must_check; all our attribute macros in Mesa appear to be uppercase, so I went with that. Signed-off-by: Kenneth Graunke kenn...@whitecape.org Cc: ch...@chris-wilson.co.uk Cc: matts...@gmail.com --- configure.ac | 1 + src/util/macros.h | 6 ++ 2 files changed, 7 insertions(+) I noticed Chris wants to use this in one of his patches, so I figured I'd throw together a patch to do this a bit more cleanly. diff --git a/configure.ac b/configure.ac index ea0f069..d240c06 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 3b708ed..66698e7 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 ) -- 2.4.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev