[Mesa-dev] [PATCH] mesa: use c99 functions on non-linux platforms if supported

Jonathan Gray jsg at jsg.id.au
Thu Aug 1 15:52:50 PDT 2013


On Thu, Aug 01, 2013 at 11:21:57AM -0700, Ian Romanick wrote:
> On 08/01/2013 09:54 AM, Chad Versace wrote:
> >On 08/01/2013 09:48 AM, Chad Versace wrote:
> >>On 08/01/2013 12:27 AM, Jonathan Gray wrote:
> >>>Signed-off-by: Jonathan Gray <jsg at jsg.id.au>
> >>>---
> >>>  src/mesa/main/imports.h | 2 +-
> >>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>
> >>>diff --git src/mesa/main/imports.h src/mesa/main/imports.h
> >>>index 53e40b4..aa7dc49 100644
> >>>--- src/mesa/main/imports.h
> >>>+++ src/mesa/main/imports.h
> >>>@@ -230,7 +230,7 @@ static inline int IS_INF_OR_NAN( float x )
> >>>   *** LDEXPF: multiply value by an integral power of two
> >>>   *** FREXPF: extract mantissa and exponent from value
> >>>   ***/
> >>>-#if defined(__gnu_linux__)
> >>>+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
> >>>  /* C99 functions */
> >>>  #define CEILF(x)   ceilf(x)
> >>>  #define FLOORF(x)  floorf(x)
> >>
> >>This patch looks good to me, but I'm unable to test it.
> >>On what platform did you test it?
> >

OpenBSD.

> >I retract the "looks good". These functions are also available
> >when compiling with `gcc -std=gnu89`, yet gnu89 does not
> >define __STDC_VERSION__.
> 
> This is the sort of issue I had in mind in my reply to this patch.
> That's why autoconf (and other build systems) can figure out what
> library functions are available and generate HAVE_CEILF, etc. macros
> for them.

There are already checks along the lines of what I'm adding
as configure.ac makes gcc compile with -std=c99

> 
> >So, use
> >#if defined(__gnu_linux) || (your_new_c99_checks)

It doesn't really make sense to do that, especially as the
rest of the file is different.


More information about the mesa-dev mailing list