Skip to content

Commit 05914bf

Browse files
committedNov 30, 2017
[CUDA] Tweak CUDA wrappers to make cuda-9 work with libc++
CUDA-9 headers check for specific libc++ version and ifdef out some of the definitions we need if LIBCPP_VERSION >= 3800. Differential Revision: https://reviews.llvm.org/D40198 llvm-svn: 319485
1 parent fbb4bac commit 05914bf

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
 

‎clang/lib/Headers/__clang_cuda_runtime_wrapper.h

+6
Original file line numberDiff line numberDiff line change
@@ -270,12 +270,18 @@ static inline __device__ void __brkpt(int __c) { __brkpt(); }
270270
// include guard from math.h wrapper from libstdc++. We have to undo the header
271271
// guard temporarily to get the definitions we need.
272272
#pragma push_macro("_GLIBCXX_MATH_H")
273+
#pragma push_macro("_LIBCPP_VERSION")
273274
#if CUDA_VERSION >= 9000
274275
#undef _GLIBCXX_MATH_H
276+
// We also need to undo another guard that checks for libc++ 3.8+
277+
#ifdef _LIBCPP_VERSION
278+
#define _LIBCPP_VERSION 3700
279+
#endif
275280
#endif
276281

277282
#include "math_functions.hpp"
278283
#pragma pop_macro("_GLIBCXX_MATH_H")
284+
#pragma pop_macro("_LIBCPP_VERSION")
279285
#pragma pop_macro("__GNUC__")
280286
#pragma pop_macro("signbit")
281287

0 commit comments

Comments
 (0)
Please sign in to comment.