[Mesa-dev] [PATCH] Add macro for unused function attribute.
Vinson Lee
vlee at freedesktop.org
Sat Mar 7 14:09:31 PST 2015
Suggested-by: Emil Velikov <emil.l.velikov at gmail.com>
Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
configure.ac | 1 +
scons/gallium.py | 1 +
src/util/macros.h | 6 ++++++
3 files changed, 8 insertions(+)
diff --git a/configure.ac b/configure.ac
index 90c7737..2954f80 100644
--- a/configure.ac
+++ b/configure.ac
@@ -195,6 +195,7 @@ AX_GCC_FUNC_ATTRIBUTE([flatten])
AX_GCC_FUNC_ATTRIBUTE([format])
AX_GCC_FUNC_ATTRIBUTE([malloc])
AX_GCC_FUNC_ATTRIBUTE([packed])
+AX_GCC_FUNC_ATTRIBUTE([unused])
AM_CONDITIONAL([GEN_ASM_OFFSETS], test "x$GEN_ASM_OFFSETS" = xyes)
diff --git a/scons/gallium.py b/scons/gallium.py
index 7533f06..b162089 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -369,6 +369,7 @@ def generate(env):
'HAVE___BUILTIN_FFS',
'HAVE___BUILTIN_FFSLL',
'HAVE_FUNC_ATTRIBUTE_FLATTEN',
+ 'HAVE_FUNC_ATTRIBUTE_UNUSED',
# GCC 3.0
'HAVE_FUNC_ATTRIBUTE_FORMAT',
'HAVE_FUNC_ATTRIBUTE_PACKED',
diff --git a/src/util/macros.h b/src/util/macros.h
index 63daba3..6c7bda7 100644
--- a/src/util/macros.h
+++ b/src/util/macros.h
@@ -176,5 +176,11 @@ do { \
# endif
#endif
+#ifdef HAVE_FUNC_ATTRIBUTE_UNUSED
+#define UNUSED __attribute__((unused))
+#else
+#define UNUSED
+#endif
+
#endif /* UTIL_MACROS_H */
--
2.3.1
More information about the mesa-dev
mailing list