[PATCH] D110781: [CUDA] Make sure <string.h> is included with original __THROW defined.

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 29 15:11:40 PDT 2021


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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110781.376049.patch
Type: text/x-patch
Size: 628 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210929/b3d825a6/attachment.bin>


More information about the cfe-commits mailing list