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

Jeremy Huddleston jeremyhu at apple.com
Wed Sep 28 10:40:46 PDT 2011


A similar fix is already in my pending PULL request with additional changes for SunCC.

http://cgit.freedesktop.org/~jeremyhu/xserver/commit/?h=for-keith&id=4cf6820858e48e5e3f73b1dbdfbb1f2b14d9a12f

On Sep 28, 2011, at 9:55 AM, Aaron Plattner wrote:

> 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
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 

---
Jeremy Huddleston

Rebuild Sudan
 - Board of Directors
 - http://www.rebuildsudan.org

Berkeley Foundation for Opportunities in Information Technology
 - Advisory Board
 - http://www.bfoit.org



More information about the xorg-devel mailing list