[PATCH] D18417: [CUDA] Don't define __NVCC__.

Justin Lebar via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 23 15:33:52 PDT 2016

jlebar created this revision.
jlebar added a reviewer: tra.
jlebar added a subscriber: cfe-commits.

We decided this makes life too difficult for code authors.  For example,
people may want to detect NVCC and disable variadic templates, which
NVCC does not support, but which we do.

Since people are going to have to change compiler flags *anyway* in
order to compile with clang, if they really want the old behavior, they
can pass -D__NVCC__.

Tested with tensorflow and thrust, no apparent problems.



Index: lib/Headers/__clang_cuda_runtime_wrapper.h
--- lib/Headers/__clang_cuda_runtime_wrapper.h
+++ lib/Headers/__clang_cuda_runtime_wrapper.h
@@ -199,7 +199,6 @@
 // Set up compiler macros expected to be seen during compilation.
 #undef __CUDABE__
 #define __CUDACC__
-#define __NVCC__
 #if defined(__CUDA_ARCH__)
 // We need to emit IR declaration for non-existing __nvvm_reflect() to

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18417.51482.patch
Type: text/x-patch
Size: 458 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160323/29ad25c4/attachment.bin>

More information about the cfe-commits mailing list