[PATCH v2] Address regressions from e8ff555b95baab66cc7d060c1e7f9fdd49d3802f

Jamey Sharp jamey at minilop.net
Thu Sep 22 20:23:12 PDT 2011


Reviewed-by: Jamey Sharp <jamey at minilop.net>

What I said for Alan's patch goes for this one too:

Seems like there ought to be a better way than listing which compilers
support it, though. I considered an autoconf test to check whether
__builtin_constant_p is defined, but that doesn't tell you which
compiler is pulling in misc.h each time it's used. Which wouldn't be an
issue if misc.h weren't part of the SDK headers. Phooey.

Jamey

On Thu, Sep 22, 2011 at 07:58:43PM -0700, Jeremy Huddleston wrote:
> On Sep 22, 2011, at 19:49, Alan Coopersmith wrote:
> > Since __builtin_constant_p is more of a keyword than a function, does the
> > magic still work when you have the extra level of indirection?
> 
> Yes.  There should be no difference since these are inlined, but in the off chance I'm wrong, I addressed your concern as:
> 
> diff --git a/include/misc.h b/include/misc.h
> index 1fea73e..4ecab59 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;
>  }
> 
> _______________________________________________
> 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/20110922/2b488ab1/attachment.pgp>


More information about the xorg-devel mailing list