msvcrt: Add INFINITY and NAN definitions to math.h.

Francois Gouget fgouget at free.fr
Mon Jan 13 06:13:34 CST 2014


On Sat, 11 Jan 2014, Jacek Caban wrote:
[...]
> __builtin_* stuff is compiler, not OS, dependent, so this should work on
> Solaris when GCC is used. We still have to use __port_nan()-like solution as a
> fallback for compilers that we can't support other way, but IMO we should try
> harder to provide a better definition.

The only NAN definitions I see on Solaris are in /usr/include/iso/math_c99.h:

#if defined(_STDC_C99) || _XOPEN_SOURCE - 0 >= 600 || defined(__C99FEATURES__)
# if defined(__GNUC__)
[...]
#  undef	NAN
#  define	NAN		(__builtin_nanf(""))
# else
[...]
#  undef	NAN
#  define	NAN		__builtin_nan
# endif

The problem is:
 * Not all systems have iso/math_c99.h so we cannot unconditionally 
   include it. But autoconf macros checks like HAVE_XXX are not allowed 
   in the Winelib headers. This means we cannot include math_c99.h from 
   our math.h header.

 * The system math.h header includes math_c99.h unconditionally. But 
   including the system math.h from our own does not seem possible (I 
   don't think forcing the Winelib users to use weird 
   -I/symlink/to/usr/include would be acceptable).

 * __builtin_nanf() is not a macro so we cannot check for it. So we'd 
   have to duplicate either Solaris' or Linux's #ifdefs but that looks 
   pretty fragile.

So I'm not sure there is much more we can do.

-- 
Francois Gouget <fgouget at free.fr>              http://fgouget.free.fr/
                           La terre est une bêta...


More information about the wine-devel mailing list