diff options
author | Jeremy Huddleston <jeremyhu@apple.com> | 2011-09-22 18:55:19 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@apple.com> | 2011-09-28 13:31:44 -0700 |
commit | 206b30ebc608d29a91cc18665d89e887cac4dba3 (patch) | |
tree | 52702b2e0d09886052625807bd8a92e9ee1bb068 | |
parent | afb1fe695d197187a301c19863a128a65389b15c (diff) |
Address regressions from e8ff555b95ba and d206d52f657c to work with other compilers
1) The error attribute appeared in gcc-4.3
2) The return type of __builtin_constant_p is int
3) Sun Studio 12.0 and later builtin support for __builtin_constant_p
Found by Tinderbox.
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
-rw-r--r-- | include/misc.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/misc.h b/include/misc.h index 1fea73ec3..0867746d2 100644 --- a/include/misc.h +++ b/include/misc.h @@ -261,14 +261,16 @@ version_compare(uint16_t a_major, uint16_t a_minor, #define SwapRestL(stuff) \ SwapLongs((CARD32 *)(stuff + 1), LengthRestL(stuff)) -#ifdef __GNUC__ +#if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) void __attribute__((error("wrong sized variable passed to swap"))) wrong_size(void); #else static inline void wrong_size(void) { } +#endif -static inline void __builtin_constant_p(int x) +#if !(defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C < 0x590))) +static inline int __builtin_constant_p(int x) { return 0; } |