[PATCH] Fix misc.h changes from d206d52f657c to work with Sun compilers

Alan Coopersmith alan.coopersmith at oracle.com
Thu Sep 22 17:31:17 PDT 2011


Studio 12.0 and later have builtin support for __builtin_constant_p and
if you try to define a function with that name, they issue an error:
"../include/misc.h", line 271: syntax error before or at: __builtin_constant_p

For older versions, the fallback definition needs to specify it returns
an int, not claim void while returning 0 and checking the return value.

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 include/misc.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/include/misc.h b/include/misc.h
index 1fea73e..da494e0 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -268,10 +268,12 @@ static inline void wrong_size(void)
 {
 }
 
-static inline void __builtin_constant_p(int x)
+# if !(defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+static inline int __builtin_constant_p(int x)
 {
 	return 0;
 }
+# endif
 #endif
 
 /* byte swap a 32-bit value */
-- 
1.7.3.2



More information about the xorg-devel mailing list