[clang] Work around two more instances of __noinline__ conflicts. (PR #66138)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 12 13:13:36 PDT 2023
llvmbot wrote:
@llvm/pr-subscribers-clang
<details>
<summary>Changes</summary>
https://github.com/llvm/llvm-project/issues/57544
--
Full diff: https://github.com/llvm/llvm-project/pull/66138.diff
3 Files Affected:
- (modified) clang/lib/Headers/CMakeLists.txt (+2)
- (added) clang/lib/Headers/cuda_wrappers/bits/basic_string.h (+9)
- (added) clang/lib/Headers/cuda_wrappers/bits/basic_string.tcc (+9)
<pre>
diff --git a/clang/lib/Headers/CMakeLists.txt b/clang/lib/Headers/CMakeLists.txt
index 39030d433a61ec7..334bc13799409bb 100644
--- a/clang/lib/Headers/CMakeLists.txt
+++ b/clang/lib/Headers/CMakeLists.txt
@@ -289,6 +289,8 @@ set(cuda_wrapper_files
set(cuda_wrapper_bits_files
cuda_wrappers/bits/shared_ptr_base.h
+ cuda_wrappers/bits/basic_string.h
+ cuda_wrappers/bits/basic_string.tcc
)
set(ppc_wrapper_files
diff --git a/clang/lib/Headers/cuda_wrappers/bits/basic_string.h b/clang/lib/Headers/cuda_wrappers/bits/basic_string.h
new file mode 100644
index 000000000000000..64f50d9f6a72e7a
--- /dev/null
+++ b/clang/lib/Headers/cuda_wrappers/bits/basic_string.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/basic_string.h"
+
+#pragma pop_macro("__noinline__")
diff --git a/clang/lib/Headers/cuda_wrappers/bits/basic_string.tcc b/clang/lib/Headers/cuda_wrappers/bits/basic_string.tcc
new file mode 100644
index 000000000000000..90c7fe34d93255f
--- /dev/null
+++ b/clang/lib/Headers/cuda_wrappers/bits/basic_string.tcc
@@ -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/basic_string.tcc"
+
+#pragma pop_macro("__noinline__")
</pre>
</details>
https://github.com/llvm/llvm-project/pull/66138
More information about the cfe-commits
mailing list