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

Jamey Sharp jamey at minilop.net
Wed Sep 28 11:03:26 PDT 2011


This is subsumed by earlier proposed patches; see this thread:

http://lists.x.org/archives/xorg-devel/2011-September/025497.html

On Wed, Sep 28, 2011 at 09:55:26AM -0700, 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110928/534769f9/attachment.pgp>


More information about the xorg-devel mailing list