]> granicus.if.org Git - clang/commitdiff
[CUDA] Tweak CUDA wrappers to make cuda-9 work with libc++
authorArtem Belevich <tra@google.com>
Thu, 30 Nov 2017 22:22:21 +0000 (22:22 +0000)
committerArtem Belevich <tra@google.com>
Thu, 30 Nov 2017 22:22:21 +0000 (22:22 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@319485 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Headers/__clang_cuda_runtime_wrapper.h

index b8ffc2ce9ffa4e1fcb0f67635aae2a0a6081dbca..a82a8490f3670803fe3bbbecfcdb3e6f7de0a670 100644 (file)
@@ -270,12 +270,18 @@ static inline __device__ void __brkpt(int __c) { __brkpt(); }
 // include guard from math.h wrapper from libstdc++. We have to undo the header
 // guard temporarily to get the definitions we need.
 #pragma push_macro("_GLIBCXX_MATH_H")
+#pragma push_macro("_LIBCPP_VERSION")
 #if CUDA_VERSION >= 9000
 #undef _GLIBCXX_MATH_H
+// We also need to undo another guard that checks for libc++ 3.8+
+#ifdef _LIBCPP_VERSION
+#define _LIBCPP_VERSION 3700
+#endif
 #endif
 
 #include "math_functions.hpp"
 #pragma pop_macro("_GLIBCXX_MATH_H")
+#pragma pop_macro("_LIBCPP_VERSION")
 #pragma pop_macro("__GNUC__")
 #pragma pop_macro("signbit")