File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 2121#define __LIBC_ATTRS __attribute__((device))
2222#endif
2323
24+ // Some headers provide these as macros. Temporarily undefine them so they do
25+ // not conflict with any definitions for the GPU.
26+
27+ #pragma push_macro("stdout")
28+ #pragma push_macro("stdin")
29+ #pragma push_macro("stderr")
30+
31+ #undef stdout
32+ #undef stderr
33+ #undef stdin
34+
2435#pragma omp begin declare target
2536
2637#include <llvm-libc-decls/stdio.h>
2940
3041#undef __LIBC_ATTRS
3142
43+ // Restore the original macros when compiling on the host.
44+ #if !defined(__NVPTX__ ) && !defined(__AMDGPU__ )
45+ #pragma pop_macro("stdout")
46+ #pragma pop_macro("stderr")
47+ #pragma pop_macro("stdin")
48+ #endif
49+
3250#endif
3351
3452#endif // __CLANG_LLVM_LIBC_WRAPPERS_STDIO_H__
You can’t perform that action at this time.
0 commit comments