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 <jason.ekstrand@intel.com> [C bits]
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Matt Turner
2014-09-21 18:14:01 -07:00
parent 4a96df73e7
commit 976464c210
5 changed files with 240 additions and 10 deletions

View File

@@ -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