[LLVMdev] Visual C Patches for IsNAN.cpp and IsInf.cpp

Paolo Invernizzi arathorn at fastwebnet.it
Tue Oct 19 03:32:52 PDT 2004


I submitted a patch keeping the traditional approach, 
HAVE_FINITE_IN_FLOAT_H and HAVE_ISNAN_IN_FLOAT...
Just another case added to the others instead of a custom approach.

---
Paolo

On Oct 19, 2004, at 12:16 PM, Morten Ofstad wrote:

> I don't know if Paolo submitted his patches for these files, but they 
> are not in the CVS -- I've chosen a slightly different strategy, 
> adding a case that checks if the compiler is MSVC instead of adding 
> HAVE_FINITE_IN_FLOAT_H and HAVE_ISNAN_IN_FLOAT_H to the config.h file.
>
> I don't know which is the best approach, but this is the minimal patch 
> to make it work...
>
> m.
>
> Index: lib/Support/IsNAN.cpp
> ===================================================================
> RCS file: /var/cvs/llvm/llvm/lib/Support/IsNAN.cpp,v
> retrieving revision 1.2
> diff -u -r1.2 IsNAN.cpp
> --- lib/Support/IsNAN.cpp	1 Sep 2004 22:55:35 -0000	1.2
> +++ lib/Support/IsNAN.cpp	19 Oct 2004 10:11:39 -0000
> @@ -19,6 +19,9 @@
>  #elif HAVE_STD_ISNAN_IN_CMATH
>  # include <cmath>
>  using std::isnan;
> +#elif defined(_MSC_VER)
> +#include <float.h>
> +#define isnan _isnan
>  #else
>  # error "Don't know how to get isnan()"
>  #endif
> Index: lib/Support/IsInf.cpp
> ===================================================================
> RCS file: /var/cvs/llvm/llvm/lib/Support/IsInf.cpp,v
> retrieving revision 1.3
> diff -u -r1.3 IsInf.cpp
> --- lib/Support/IsInf.cpp	1 Sep 2004 22:55:35 -0000	1.3
> +++ lib/Support/IsInf.cpp	19 Oct 2004 10:11:39 -0000
> @@ -24,6 +24,9 @@
>  // apparently this has been a problem with Solaris for years.
>  # include <ieeefp.h>
>  static int isinf(double x) { return !finite(x) && x==x; }
> +#elif defined(_MSC_VER)
> +#include <float.h>
> +#define isinf !_finite
>  #else
>  # error "Don't know how to get isinf()"
>  #endif
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list