From: Grazvydas Ignotas Date: Sat, 16 Apr 2016 01:00:10 +0000 (+0300) Subject: util: add MAYBE_UNUSED for config dependent variables X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e4fc06a2f8be2de3a08d4adfa4a26df2ae0b5cae;p=mesa.git util: add MAYBE_UNUSED for config dependent variables This is mostly for variables that are only used in asserts and cause unused-but-set-variable warnings in release builds. Could just use UNUSED directly, but MAYBE_UNUSED should be less confusing and is similar to what the Linux kernel has. And yes __attribute__((unused)) can be used on variables on both GCC 4.2 (oldest supported by mesa) and clang 3.0 (just some random old version, not sure what's the minimum for mesa). Signed-off-by: Grazvydas Ignotas Reviewed-by: Francisco Jerez Reviewed-by: Chad Versace Reviewed-by: Ian Romanick Reviewed-by: Emil Velikov --- diff --git a/src/util/macros.h b/src/util/macros.h index 0c8958feae9..f081bb82177 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -204,6 +204,8 @@ do { \ #define UNUSED #endif +#define MAYBE_UNUSED UNUSED + #ifdef HAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT #define MUST_CHECK __attribute__((warn_unused_result)) #else