[Mesa-dev] [PATCH] mesa: Portably detect the availability of fpclassify.
Ian Romanick
idr at freedesktop.org
Wed Dec 4 18:16:31 PST 2013
On 11/20/2013 01:15 PM, Jonas 'Sortie' Termansen wrote:
> POSIX 2008 mandates fpclassify, FP_INFINITE, FP_NAN, FP_NORMAL, FP_SUBNORMAL,
And C99.
> and FP_ZERO are all macros and we can therefore detect them through simple
> preprocessor conditionals on compliant platforms. This avoids further growth
> of the current preprocessor list of platforms that has fpclassify. I retained
> the current platform list as I could not confirm whether all the currently
> supported platforms correctly declare all these as macros.
> ---
> src/mesa/main/querymatrix.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/main/querymatrix.c b/src/mesa/main/querymatrix.c
> index 19a8e92..4507343 100644
> --- a/src/mesa/main/querymatrix.c
> +++ b/src/mesa/main/querymatrix.c
> @@ -37,7 +37,12 @@
> #define INT_TO_FIXED(x) ((GLfixed) ((x) << 16))
> #define FLOAT_TO_FIXED(x) ((GLfixed) ((x) * 65536.0))
>
> -#if defined(_MSC_VER)
> +#if defined(fpclassify) && defined(FP_INFINITE) && defined(FP_NAN) && \
> + defined(FP_NORMAL) && defined(FP_SUBNORMAL) && defined(FP_ZERO)
> +
> +/* fpclassify is available. */
> +
> +#elif defined(_MSC_VER)
> #if _MSC_VER < 1800 /* Not required on VS2013 and above. */
> /* Oddly, the fpclassify() function doesn't exist in such a form
> * on MSVC. This is an implementation using slightly different
>
Shouldn't the other /* fpclassify is available. */ block (below) get
removed? I think we could also get rid of the '#if _MSC_VER < 1800'
check as well, since the new '#if defined' block will already catch that
case. That should probably be a separate patch, however.
More information about the mesa-dev
mailing list