[PATCH] D149364: [CUDA] Temporarily undefine __noinline__ when including bits/shared_ptr_base.h

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 27 11:16:08 PDT 2023


tra created this revision.
Herald added subscribers: mattd, carlosgalvezp, bixia, yaxunl.
Herald added a project: All.
tra updated this revision to Diff 517656.
tra added a comment.
tra published this revision for review.
tra added reviewers: jlebar, phawkins.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Removed warning.


This avoid CUDA compilation errors caused by CUDA headers defining __noinline__
and conflicting with __noinline__ use in libstdc++.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149364

Files:
  clang/lib/Headers/CMakeLists.txt
  clang/lib/Headers/cuda_wrappers/bits/shared_ptr_base.h


Index: clang/lib/Headers/cuda_wrappers/bits/shared_ptr_base.h
===================================================================
--- /dev/null
+++ clang/lib/Headers/cuda_wrappers/bits/shared_ptr_base.h
@@ -0,0 +1,9 @@
+// CUDA headers define __noinline__ which interferes with libstdc++'s use of
+// `__attribute((__noinline__))`. In order to avoid compilation error,
+// temporarily unset __noinline__ when we include affected libstdc++ header.
+
+#pragma push_macro("__noinline__")
+#undef __noinline__
+#include_next "bits/shared_ptr_base.h"
+
+#pragma pop_macro("__noinline__")
Index: clang/lib/Headers/CMakeLists.txt
===================================================================
--- clang/lib/Headers/CMakeLists.txt
+++ clang/lib/Headers/CMakeLists.txt
@@ -257,6 +257,7 @@
   cuda_wrappers/cmath
   cuda_wrappers/complex
   cuda_wrappers/new
+  cuda_wrappers/bits/shared_ptr_base.h
 )
 
 set(ppc_wrapper_files


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149364.517656.patch
Type: text/x-patch
Size: 922 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230427/7b6e4272/attachment.bin>


More information about the cfe-commits mailing list