Skip to content

Commit 11d5116

Browse files
author
Justin Lebar
committedJan 5, 2017
[CUDA] Don't define functions that the CUDA headers themselves define on Windows.
Reviewers: tra Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28324 llvm-svn: 291137
1 parent 86c4e63 commit 11d5116

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed
 

‎clang/lib/Headers/__clang_cuda_cmath.h

+8-2
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,21 @@ __DEVICE__ int fpclassify(double __x) {
7272
__DEVICE__ float frexp(float __arg, int *__exp) {
7373
return ::frexpf(__arg, __exp);
7474
}
75+
76+
// For inscrutable reasons, the CUDA headers define these functions for us on
77+
// Windows.
78+
#ifndef _MSC_VER
7579
__DEVICE__ bool isinf(float __x) { return ::__isinff(__x); }
7680
__DEVICE__ bool isinf(double __x) { return ::__isinf(__x); }
7781
__DEVICE__ bool isfinite(float __x) { return ::__finitef(__x); }
7882
// For inscrutable reasons, __finite(), the double-precision version of
7983
// __finitef, does not exist when compiling for MacOS. __isfinited is available
8084
// everywhere and is just as good.
8185
__DEVICE__ bool isfinite(double __x) { return ::__isfinited(__x); }
86+
__DEVICE__ bool isnan(float __x) { return ::__isnanf(__x); }
87+
__DEVICE__ bool isnan(double __x) { return ::__isnan(__x); }
88+
#endif
89+
8290
__DEVICE__ bool isgreater(float __x, float __y) {
8391
return __builtin_isgreater(__x, __y);
8492
}
@@ -109,8 +117,6 @@ __DEVICE__ bool islessgreater(float __x, float __y) {
109117
__DEVICE__ bool islessgreater(double __x, double __y) {
110118
return __builtin_islessgreater(__x, __y);
111119
}
112-
__DEVICE__ bool isnan(float __x) { return ::__isnanf(__x); }
113-
__DEVICE__ bool isnan(double __x) { return ::__isnan(__x); }
114120
__DEVICE__ bool isnormal(float __x) { return __builtin_isnormal(__x); }
115121
__DEVICE__ bool isnormal(double __x) { return __builtin_isnormal(__x); }
116122
__DEVICE__ bool isunordered(float __x, float __y) {

0 commit comments

Comments
 (0)
Please sign in to comment.