tambre created this revision. tambre added a reviewer: tra. Herald added subscribers: cfe-commits, yaxunl. Herald added a project: clang. tambre edited the summary of this revision. tambre edited the summary of this revision. tra added inline comments.
================ Comment at: clang/lib/Headers/__clang_cuda_runtime_wrapper.h:44 #include <stdlib.h> // Preserve common macros that will be changed below by us or by CUDA ---------------- We should undef __CUDACC__ here to make sure it does not affect anything else in the headers we include further down. libstdc++ since version 7 when GNU extensions are enabled (e.g. -std=gnu++11) use it to avoid defining overloads using `__float128`. This fixes compiling with GNU extensions failing due to `__float128` being used. Discovered at https://gitlab.kitware.com/cmake/cmake/-/merge_requests/4442#note_737136. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D78392 Files: clang/lib/Headers/__clang_cuda_runtime_wrapper.h Index: clang/lib/Headers/__clang_cuda_runtime_wrapper.h =================================================================== --- clang/lib/Headers/__clang_cuda_runtime_wrapper.h +++ clang/lib/Headers/__clang_cuda_runtime_wrapper.h @@ -31,6 +31,11 @@ // Include some forward declares that must come before cmath. #include <__clang_cuda_math_forward_declares.h> +// Define __CUDACC__ early as libstdc++ standard headers with GNU extensions +// enabled depend on it to avoid using __float128, which is unsupported in +// CUDA. +#define __CUDACC__ + // Include some standard headers to avoid CUDA headers including them // while some required macros (like __THROW) are in a weird state. #include <cmath>
Index: clang/lib/Headers/__clang_cuda_runtime_wrapper.h =================================================================== --- clang/lib/Headers/__clang_cuda_runtime_wrapper.h +++ clang/lib/Headers/__clang_cuda_runtime_wrapper.h @@ -31,6 +31,11 @@ // Include some forward declares that must come before cmath. #include <__clang_cuda_math_forward_declares.h> +// Define __CUDACC__ early as libstdc++ standard headers with GNU extensions +// enabled depend on it to avoid using __float128, which is unsupported in +// CUDA. +#define __CUDACC__ + // Include some standard headers to avoid CUDA headers including them // while some required macros (like __THROW) are in a weird state. #include <cmath>
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits