d3dx9_36/tests: Fix compilation on systems that don't have NAN (Solaris).

Francois Gouget fgouget at free.fr
Fri Jan 10 08:33:06 CST 2014


---

An alternative would be to add a dependency on msvcrt so that we include 
Wine's math.h which is now garanteed to define NAN, instead of the 
system C headers which may or may not.

However, besides NAN, d3d9x_36 is really unrelated to msvcrt so 
introducing such a dependency feels wrong. Also our other 
conformance tests don't seem to depend on it (or it's well obscured by 
the build system) so it does not seem to be the preferred approach. So I 
just added a conditional definition for NAN (one more).


 dlls/d3dx9_36/tests/mesh.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c
index 21c3b41..47a1b1f 100644
--- a/dlls/d3dx9_36/tests/mesh.c
+++ b/dlls/d3dx9_36/tests/mesh.c
@@ -26,6 +26,16 @@
 #include "wine/test.h"
 #include "d3dx9.h"
 
+#ifndef NAN
+/* From wine/port.h */
+static inline float __port_nan(void)
+{
+    static const unsigned __nan_bytes = 0x7fc00000;
+    return *(const float *)&__nan_bytes;
+}
+#define NAN __port_nan()
+#endif
+
 /* Set the WINETEST_DEBUG environment variable to be greater than 1 for verbose
  * function call traces of ID3DXAllocateHierarchy callbacks. */
 #define TRACECALLBACK if(winetest_debug > 1) trace
-- 
1.8.5.2



More information about the wine-patches mailing list