[PATCH] misc.h: GCC's 'error' attribute was introduced in GCC 4.3

Aaron Plattner aplattner at nvidia.com
Wed Sep 28 09:55:26 PDT 2011


Older versions of GCC produce a warning when this attribute is used.

Signed-off-by: Aaron Plattner <aplattner at nvidia.com>
---
 include/misc.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/include/misc.h b/include/misc.h
index 1fea73e..193b10f 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -261,13 +261,15 @@ version_compare(uint16_t a_major, uint16_t a_minor,
 #define SwapRestL(stuff) \
     SwapLongs((CARD32 *)(stuff + 1), LengthRestL(stuff))
 
-#ifdef __GNUC__
+#if (__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
 
+#if !defined(__GNUC__)
 static inline void __builtin_constant_p(int x)
 {
 	return 0;
-- 
1.7.4.1



More information about the xorg-devel mailing list