Skip to content

[CUDA] work around more __noinline__ conflicts with libc++ #74123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions clang/lib/Headers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,12 @@ set(files
)

set(cuda_wrapper_files
cuda_wrappers/__config
cuda_wrappers/algorithm
cuda_wrappers/cmath
cuda_wrappers/complex
cuda_wrappers/new
cuda_wrappers/string
)

set(cuda_wrapper_bits_files
Expand Down
10 changes: 10 additions & 0 deletions clang/lib/Headers/cuda_wrappers/__config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// CUDA headers define __noinline__ which interferes with libc++'s use of
// `__attribute((__noinline__))`. In order to avoid compilation error,
// temporarily unset __noinline__ when we include affected libc++ header.

#pragma push_macro("__noinline__")
#undef __noinline__
#define __noinline__ __noinline__
#include_next <__config>

#pragma pop_macro("__noinline__")
10 changes: 10 additions & 0 deletions clang/lib/Headers/cuda_wrappers/string
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// CUDA headers define __noinline__ which interferes with libc++'s use of
// `__attribute((__noinline__))`. In order to avoid compilation error,
// temporarily unset __noinline__ when we include affected libc++ header.

#pragma push_macro("__noinline__")
#undef __noinline__
#define __noinline__ __noinline__
#include_next <string>

#pragma pop_macro("__noinline__")