Mesa (master): gallium: fix gcc compile errors when using _XOPEN_SOURCE= 600 but not std=c99

Roland Scheidegger sroland at kemper.freedesktop.org
Fri Apr 3 17:22:29 UTC 2015


Module: Mesa
Branch: master
Commit: 328375d2742a3394dc481fc5fae6c4a5d797b4e7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=328375d2742a3394dc481fc5fae6c4a5d797b4e7

Author: Jose Fonseca <jfonseca at vmware.com>
Date:   Thu Apr  2 17:35:16 2015 +0200

gallium: fix gcc compile errors when using _XOPEN_SOURCE=600 but not std=c99

The fpclassify stuff either needs std=c99 or _XOPEN_SOURCE=600 passed
to gcc, but when using the latter the lrint family of function will be defined
too.

---

 include/c99_math.h |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/c99_math.h b/include/c99_math.h
index ee0dd10..7ed7cc2 100644
--- a/include/c99_math.h
+++ b/include/c99_math.h
@@ -83,7 +83,11 @@ roundf(float x)
 
 
 #if (defined(_MSC_VER) && _MSC_VER < 1800) || \
-    (!defined(_MSC_VER) && __STDC_VERSION__ < 199901L && !defined(__cplusplus))
+    (!defined(_MSC_VER) && \
+     __STDC_VERSION__ < 199901L && \
+     (!defined(_XOPEN_SOURCE) || _XOPEN_SOURCE < 600) && \
+     !defined(__cplusplus))
+
 static inline long int
 lrint(double d)
 {
@@ -135,6 +139,7 @@ llrintf(float f)
 
    return rounded;
 }
+
 #endif /* C99 */
 
 




More information about the mesa-commit mailing list