[PATCH] D37906: [CUDA] Work around a new quirk in CUDA9 headers.

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 15 10:32:16 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL313369: [CUDA] Work around a new quirk in CUDA9 headers. (authored by tra).

Changed prior to commit:
  https://reviews.llvm.org/D37906?vs=115415&id=115422#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D37906

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


Index: cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h
===================================================================
--- cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h
+++ cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h
@@ -254,7 +254,17 @@
 #pragma push_macro("__GNUC__")
 #undef __GNUC__
 #define signbit __ignored_cuda_signbit
+
+// CUDA-9 omits device-side definitions of some math functions if it sees
+// 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")
+#if CUDA_VERSION >= 9000
+#undef _GLIBCXX_MATH_H
+#endif
+
 #include "math_functions.hpp"
+#pragma pop_macro("_GLIBCXX_MATH_H")
 #pragma pop_macro("__GNUC__")
 #pragma pop_macro("signbit")
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37906.115422.patch
Type: text/x-patch
Size: 795 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170915/d9f75d8b/attachment.bin>


More information about the cfe-commits mailing list