[clang] cc24455 - [libc] Fix wrapper headers for some ctype macros and C++ decls
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 28 08:00:48 PDT 2023
Author: Joseph Huber
Date: 2023-09-28T10:00:34-05:00
New Revision: cc2445589d75c737ddf636ec1f1008b34939bfb7
URL: https://github.com/llvm/llvm-project/commit/cc2445589d75c737ddf636ec1f1008b34939bfb7
DIFF: https://github.com/llvm/llvm-project/commit/cc2445589d75c737ddf636ec1f1008b34939bfb7.diff
LOG: [libc] Fix wrapper headers for some ctype macros and C++ decls
Summary:
These wrapper headers need to work around things in the standard
headers. The existing workarounds didn't correctly handle the macros for
`iscascii` and `toascii`. Additionally, `memrchr` can't be used because
it has a different declaration for C++ mode. Fix this so it can be
compiled.
Added:
Modified:
clang/lib/Headers/llvm_libc_wrappers/ctype.h
libc/config/gpu/entrypoints.txt
libc/docs/gpu/support.rst
Removed:
################################################################################
diff --git a/clang/lib/Headers/llvm_libc_wrappers/ctype.h b/clang/lib/Headers/llvm_libc_wrappers/ctype.h
index e20b7bb58f43b2d..084c5a97765a360 100644
--- a/clang/lib/Headers/llvm_libc_wrappers/ctype.h
+++ b/clang/lib/Headers/llvm_libc_wrappers/ctype.h
@@ -26,6 +26,7 @@
#pragma push_macro("isalnum")
#pragma push_macro("isalpha")
+#pragma push_macro("isascii")
#pragma push_macro("isblank")
#pragma push_macro("iscntrl")
#pragma push_macro("isdigit")
@@ -36,11 +37,13 @@
#pragma push_macro("isspace")
#pragma push_macro("isupper")
#pragma push_macro("isxdigit")
+#pragma push_macro("toascii")
#pragma push_macro("tolower")
#pragma push_macro("toupper")
#undef isalnum
#undef isalpha
+#undef isascii
#undef iscntrl
#undef isdigit
#undef islower
@@ -51,6 +54,7 @@
#undef isupper
#undef isblank
#undef isxdigit
+#undef toascii
#undef tolower
#undef toupper
@@ -64,6 +68,7 @@
#if !defined(__NVPTX__) && !defined(__AMDGPU__)
#pragma pop_macro("isalnum")
#pragma pop_macro("isalpha")
+#pragma pop_macro("isascii")
#pragma pop_macro("isblank")
#pragma pop_macro("iscntrl")
#pragma pop_macro("isdigit")
@@ -74,6 +79,7 @@
#pragma pop_macro("isspace")
#pragma pop_macro("isupper")
#pragma pop_macro("isxdigit")
+#pragma pop_macro("toascii")
#pragma pop_macro("tolower")
#pragma pop_macro("toupper")
#endif
diff --git a/libc/config/gpu/entrypoints.txt b/libc/config/gpu/entrypoints.txt
index 4f24420d6d7c669..ad68216a76b9429 100644
--- a/libc/config/gpu/entrypoints.txt
+++ b/libc/config/gpu/entrypoints.txt
@@ -29,7 +29,6 @@ set(TARGET_LIBC_ENTRYPOINTS
libc.src.string.memmem
libc.src.string.memmove
libc.src.string.mempcpy
- libc.src.string.memrchr
libc.src.string.memset
libc.src.string.stpcpy
libc.src.string.stpncpy
diff --git a/libc/docs/gpu/support.rst b/libc/docs/gpu/support.rst
index 81b17884a44023c..fd27273ed562e49 100644
--- a/libc/docs/gpu/support.rst
+++ b/libc/docs/gpu/support.rst
@@ -52,7 +52,7 @@ memcmp |check|
memcpy |check|
memmove |check|
mempcpy |check|
-memrchr |check|
+memrchr
memset |check|
stpcpy |check|
stpncpy |check|
More information about the cfe-commits
mailing list