tra created this revision.
tra added a reviewer: jdoerfert.
Herald added subscribers: bixia, yaxunl.
tra requested review of this revision.
Herald added a project: clang.

Otherwise we may end up with an inconsistent redeclarations of the standard
library functions if _FORTIFY_SOURCE is in effect.

Fixes https://bugs.llvm.org/show_bug.cgi?id=47869


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110781

Files:
  clang/lib/Headers/__clang_cuda_runtime_wrapper.h


Index: clang/lib/Headers/__clang_cuda_runtime_wrapper.h
===================================================================
--- clang/lib/Headers/__clang_cuda_runtime_wrapper.h
+++ clang/lib/Headers/__clang_cuda_runtime_wrapper.h
@@ -208,7 +208,11 @@
 // CUDA-9.2 needs host-side memcpy for some host functions in
 // device_functions.hpp
 #if CUDA_VERSION >= 9020
+// string.h needs __THROW to match the rest of the system includes.
+#pragma pop_macro("__THROW")
 #include <string.h>
+// .. but we still need to undef it in order to include other CUDA headers.
+#undef __THROW
 #endif
 #include "crt/math_functions.hpp"
 #else


Index: clang/lib/Headers/__clang_cuda_runtime_wrapper.h
===================================================================
--- clang/lib/Headers/__clang_cuda_runtime_wrapper.h
+++ clang/lib/Headers/__clang_cuda_runtime_wrapper.h
@@ -208,7 +208,11 @@
 // CUDA-9.2 needs host-side memcpy for some host functions in
 // device_functions.hpp
 #if CUDA_VERSION >= 9020
+// string.h needs __THROW to match the rest of the system includes.
+#pragma pop_macro("__THROW")
 #include <string.h>
+// .. but we still need to undef it in order to include other CUDA headers.
+#undef __THROW
 #endif
 #include "crt/math_functions.hpp"
 #else
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to