[PATCH] D28324: [CUDA] Don't define functions that the CUDA headers themselves define on Windows.

Justin Lebar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 5 09:04:51 PST 2017


This revision was automatically updated to reflect the committed changes.
jlebar marked an inline comment as done.
Closed by commit rL291137: [CUDA] Don't define functions that the CUDA headers themselves define on… (authored by jlebar).

Changed prior to commit:
  https://reviews.llvm.org/D28324?vs=83132&id=83260#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28324

Files:
  cfe/trunk/lib/Headers/__clang_cuda_cmath.h


Index: cfe/trunk/lib/Headers/__clang_cuda_cmath.h
===================================================================
--- cfe/trunk/lib/Headers/__clang_cuda_cmath.h
+++ cfe/trunk/lib/Headers/__clang_cuda_cmath.h
@@ -72,13 +72,21 @@
 __DEVICE__ float frexp(float __arg, int *__exp) {
   return ::frexpf(__arg, __exp);
 }
+
+// For inscrutable reasons, the CUDA headers define these functions for us on
+// Windows.
+#ifndef _MSC_VER
 __DEVICE__ bool isinf(float __x) { return ::__isinff(__x); }
 __DEVICE__ bool isinf(double __x) { return ::__isinf(__x); }
 __DEVICE__ bool isfinite(float __x) { return ::__finitef(__x); }
 // For inscrutable reasons, __finite(), the double-precision version of
 // __finitef, does not exist when compiling for MacOS.  __isfinited is available
 // everywhere and is just as good.
 __DEVICE__ bool isfinite(double __x) { return ::__isfinited(__x); }
+__DEVICE__ bool isnan(float __x) { return ::__isnanf(__x); }
+__DEVICE__ bool isnan(double __x) { return ::__isnan(__x); }
+#endif
+
 __DEVICE__ bool isgreater(float __x, float __y) {
   return __builtin_isgreater(__x, __y);
 }
@@ -109,8 +117,6 @@
 __DEVICE__ bool islessgreater(double __x, double __y) {
   return __builtin_islessgreater(__x, __y);
 }
-__DEVICE__ bool isnan(float __x) { return ::__isnanf(__x); }
-__DEVICE__ bool isnan(double __x) { return ::__isnan(__x); }
 __DEVICE__ bool isnormal(float __x) { return __builtin_isnormal(__x); }
 __DEVICE__ bool isnormal(double __x) { return __builtin_isnormal(__x); }
 __DEVICE__ bool isunordered(float __x, float __y) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28324.83260.patch
Type: text/x-patch
Size: 1560 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170105/9a9ee957/attachment.bin>


More information about the cfe-commits mailing list