[llvm-branch-commits] [clang] 87ec1f4 - Work around two more instances of __noinline__ conflicts. (#66138)

Tobias Hieta via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Sep 28 23:26:33 PDT 2023


Author: Artem Belevich
Date: 2023-09-29T08:23:49+02:00
New Revision: 87ec1f460d0efbc565e89f817af73c2496361749

URL: https://github.com/llvm/llvm-project/commit/87ec1f460d0efbc565e89f817af73c2496361749
DIFF: https://github.com/llvm/llvm-project/commit/87ec1f460d0efbc565e89f817af73c2496361749.diff

LOG: Work around two more instances of __noinline__ conflicts. (#66138)

Fixes https://github.com/llvm/llvm-project/issues/57544

(cherry picked from commit 588023ddafb4b0cd11914ab068c6d07187374d69)

Added: 
    clang/lib/Headers/cuda_wrappers/bits/basic_string.h
    clang/lib/Headers/cuda_wrappers/bits/basic_string.tcc

Modified: 
    clang/lib/Headers/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/clang/lib/Headers/CMakeLists.txt b/clang/lib/Headers/CMakeLists.txt
index f2b0c5cddcbbf80..db47de2ad9655f3 100644
--- a/clang/lib/Headers/CMakeLists.txt
+++ b/clang/lib/Headers/CMakeLists.txt
@@ -275,6 +275,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 llvm-branch-commits mailing list