[clang] Work around two more instances of __noinline__ conflicts. (PR #66138)
Artem Belevich via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 12 13:12:27 PDT 2023
https://github.com/Artem-B created https://github.com/llvm/llvm-project/pull/66138:
https://github.com/llvm/llvm-project/issues/57544
>From 91c9d12e8f71cd55c877f80a0820615531cb62bd Mon Sep 17 00:00:00 2001
From: Artem Belevich <tra at google.com>
Date: Tue, 12 Sep 2023 11:47:17 -0700
Subject: [PATCH] Work around two more instances of __noinline__ conflicts.
https://github.com/llvm/llvm-project/issues/57544
---
clang/lib/Headers/CMakeLists.txt | 2 ++
clang/lib/Headers/cuda_wrappers/bits/basic_string.h | 9 +++++++++
clang/lib/Headers/cuda_wrappers/bits/basic_string.tcc | 9 +++++++++
3 files changed, 20 insertions(+)
create mode 100644 clang/lib/Headers/cuda_wrappers/bits/basic_string.h
create mode 100644 clang/lib/Headers/cuda_wrappers/bits/basic_string.tcc
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__")
More information about the cfe-commits
mailing list