summaryrefslogtreecommitdiffstats
path: root/src/util/macros.h
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2014-09-21 18:14:01 -0700
committerMatt Turner <[email protected]>2014-09-25 13:52:55 -0700
commit976464c210816ff0c90e2e24e766dda81193fc79 (patch)
tree2d5bc60e59715fc38693c9b41eec6de930319e81 /src/util/macros.h
parent4a96df73e770bcca6396d3c8ffe3fd1693c73e50 (diff)
mesa: Replace a priori knowledge of gcc attributes with configure tests.
Note that I had to add support for testing the packed attribute to m4/ax_gcc_func_attribute.m4. Reviewed-by: Jason Ekstrand <[email protected]> [C bits] Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/util/macros.h')
-rw-r--r--src/util/macros.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/util/macros.h b/src/util/macros.h
index 2e2f90f587c..a9867b41354 100644
--- a/src/util/macros.h
+++ b/src/util/macros.h
@@ -75,24 +75,27 @@ do { \
#define unreachable(str)
#endif
+#ifdef HAVE_FUNC_ATTRIBUTE_FLATTEN
+#define FLATTEN __attribute__((__flatten__))
+#else
+#define FLATTEN
+#endif
-#if (__GNUC__ >= 3)
+#ifdef HAVE_FUNC_ATTRIBUTE_FORMAT
#define PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a)))
#else
#define PRINTFLIKE(f, a)
#endif
-
/* Used to optionally mark structures with misaligned elements or size as
* packed, to trade off performance for space.
*/
-#if (__GNUC__ >= 3)
+#ifdef HAVE_FUNC_ATTRIBUTE_PACKED
#define PACKED __attribute__((__packed__))
#else
#define PACKED
#endif
-
#ifdef __cplusplus
/**
* Macro function that evaluates to true if T is a trivially