On Thu, Sep 22, 2011 at 8:31 PM, Alan Coopersmith
<[email protected]> wrote:
> 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 <[email protected]>
> ---
>  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

I see that I specified the wrong return type. That was silly.

Reviewed-by: Matt Turner <[email protected]>
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to