diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2023-02-11 12:38:04 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2023-02-11 12:38:11 +0000 |
| commit | e3b557809604d036af6e00c60f012c2025b59a5e (patch) | |
| tree | 8a11ba2269a3b669601e2fd41145b174008f4da8 /libcxx/include/string.h | |
| parent | 08e8dd7b9db7bb4a9de26d44c1cbfd24e869c014 (diff) | |
Diffstat (limited to 'libcxx/include/string.h')
| -rw-r--r-- | libcxx/include/string.h | 72 |
1 files changed, 37 insertions, 35 deletions
diff --git a/libcxx/include/string.h b/libcxx/include/string.h index 082c632a29bc..3ec877bad310 100644 --- a/libcxx/include/string.h +++ b/libcxx/include/string.h @@ -57,7 +57,9 @@ size_t strlen(const char* s); # pragma GCC system_header #endif -#include_next <string.h> +#if __has_include_next(<string.h>) +# include_next <string.h> +#endif // MSVCRT, GNU libc and its derivates may already have the correct prototype in // <string.h>. This macro can be defined by users if their C library provides @@ -69,41 +71,41 @@ size_t strlen(const char* s); #if defined(__cplusplus) && !defined(_LIBCPP_STRING_H_HAS_CONST_OVERLOADS) && defined(_LIBCPP_PREFERRED_OVERLOAD) extern "C++" { -inline _LIBCPP_INLINE_VISIBILITY -char* __libcpp_strchr(const char* __s, int __c) {return (char*)strchr(__s, __c);} -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD -const char* strchr(const char* __s, int __c) {return __libcpp_strchr(__s, __c);} -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD - char* strchr( char* __s, int __c) {return __libcpp_strchr(__s, __c);} - -inline _LIBCPP_INLINE_VISIBILITY -char* __libcpp_strpbrk(const char* __s1, const char* __s2) {return (char*)strpbrk(__s1, __s2);} -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD -const char* strpbrk(const char* __s1, const char* __s2) {return __libcpp_strpbrk(__s1, __s2);} -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD - char* strpbrk( char* __s1, const char* __s2) {return __libcpp_strpbrk(__s1, __s2);} - -inline _LIBCPP_INLINE_VISIBILITY -char* __libcpp_strrchr(const char* __s, int __c) {return (char*)strrchr(__s, __c);} -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD -const char* strrchr(const char* __s, int __c) {return __libcpp_strrchr(__s, __c);} -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD - char* strrchr( char* __s, int __c) {return __libcpp_strrchr(__s, __c);} - -inline _LIBCPP_INLINE_VISIBILITY -void* __libcpp_memchr(const void* __s, int __c, size_t __n) {return (void*)memchr(__s, __c, __n);} -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD -const void* memchr(const void* __s, int __c, size_t __n) {return __libcpp_memchr(__s, __c, __n);} -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD - void* memchr( void* __s, int __c, size_t __n) {return __libcpp_memchr(__s, __c, __n);} - -inline _LIBCPP_INLINE_VISIBILITY -char* __libcpp_strstr(const char* __s1, const char* __s2) {return (char*)strstr(__s1, __s2);} -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD -const char* strstr(const char* __s1, const char* __s2) {return __libcpp_strstr(__s1, __s2);} -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD - char* strstr( char* __s1, const char* __s2) {return __libcpp_strstr(__s1, __s2);} +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const char* strchr(const char* __s, int __c) { + return __builtin_strchr(__s, __c); +} +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD char* strchr(char* __s, int __c) { + return __builtin_strchr(__s, __c); +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const char* strpbrk(const char* __s1, const char* __s2) { + return __builtin_strpbrk(__s1, __s2); +} +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD char* strpbrk(char* __s1, const char* __s2) { + return __builtin_strpbrk(__s1, __s2); +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const char* strrchr(const char* __s, int __c) { + return __builtin_strrchr(__s, __c); +} +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD char* strrchr(char* __s, int __c) { + return __builtin_strrchr(__s, __c); +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const void* memchr(const void* __s, int __c, size_t __n) { + return __builtin_memchr(__s, __c, __n); +} +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD void* memchr(void* __s, int __c, size_t __n) { + return __builtin_memchr(__s, __c, __n); +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD const char* strstr(const char* __s1, const char* __s2) { + return __builtin_strstr(__s1, __s2); +} +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD char* strstr(char* __s1, const char* __s2) { + return __builtin_strstr(__s1, __s2); } +} // extern "C++" #endif #endif // _LIBCPP_STRING_H |
