[PATCH] D13409: Use MSVCRT functions for floating-point builtins unavailable on MSVC

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 4 11:17:14 PDT 2015


compnerd added a comment.

If Im not mistaken this will now need a larger number of function implementations to support `-ffreestanding` on Windows?


================
Comment at: lib/builtins/int_math.h:28
@@ -27,2 +27,3 @@
 
-#define CRT_INFINITY __builtin_huge_valf()
+#ifdef _MSC_VER
+#include <math.h>
----------------
Shouldn't this be:

    #if defined(_MSC_VER) && !defined(__clang__)

and throughout.

================
Comment at: lib/builtins/int_math.h:51
@@ -38,3 +50,3 @@
 #  define crt_isfinite(x) __builtin_isfinite((x))
-#else
+#elif !defined(_MSC_VER)
 #  define crt_isfinite(x) \
----------------
I think this particular case should be:

    #elif defined(__GNU__)

The `__extension__` usage is a GNU extension, and `__GNU__` will be defined on clang, so that should be more precise and should work without much effort.

Also, please add an

    #else
    #error "do not not how to check for infinity"
    #endif


http://reviews.llvm.org/D13409





More information about the llvm-commits mailing list