Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | // -*- C++ -*- |
Louis Dionne | 9bd9388 | 2021-11-17 16:25:01 -0500 | [diff] [blame] | 2 | //===----------------------------------------------------------------------===// |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 3 | // |
Chandler Carruth | 7642bb1 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 | // See https://llvm.org/LICENSE.txt for license information. |
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef _LIBCPP_CSTRING |
| 11 | #define _LIBCPP_CSTRING |
| 12 | |
| 13 | /* |
| 14 | cstring synopsis |
| 15 | |
| 16 | Macros: |
| 17 | |
| 18 | NULL |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 19 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 20 | namespace std |
| 21 | { |
| 22 | |
| 23 | Types: |
| 24 | |
| 25 | size_t |
| 26 | |
| 27 | void* memcpy(void* restrict s1, const void* restrict s2, size_t n); |
| 28 | void* memmove(void* s1, const void* s2, size_t n); |
| 29 | char* strcpy (char* restrict s1, const char* restrict s2); |
| 30 | char* strncpy(char* restrict s1, const char* restrict s2, size_t n); |
| 31 | char* strcat (char* restrict s1, const char* restrict s2); |
| 32 | char* strncat(char* restrict s1, const char* restrict s2, size_t n); |
| 33 | int memcmp(const void* s1, const void* s2, size_t n); |
| 34 | int strcmp (const char* s1, const char* s2); |
| 35 | int strncmp(const char* s1, const char* s2, size_t n); |
| 36 | int strcoll(const char* s1, const char* s2); |
| 37 | size_t strxfrm(char* restrict s1, const char* restrict s2, size_t n); |
| 38 | const void* memchr(const void* s, int c, size_t n); |
| 39 | void* memchr( void* s, int c, size_t n); |
| 40 | const char* strchr(const char* s, int c); |
| 41 | char* strchr( char* s, int c); |
| 42 | size_t strcspn(const char* s1, const char* s2); |
| 43 | const char* strpbrk(const char* s1, const char* s2); |
| 44 | char* strpbrk( char* s1, const char* s2); |
| 45 | const char* strrchr(const char* s, int c); |
| 46 | char* strrchr( char* s, int c); |
| 47 | size_t strspn(const char* s1, const char* s2); |
| 48 | const char* strstr(const char* s1, const char* s2); |
| 49 | char* strstr( char* s1, const char* s2); |
| 50 | char* strtok(char* restrict s1, const char* restrict s2); |
| 51 | void* memset(void* s, int c, size_t n); |
| 52 | char* strerror(int errnum); |
| 53 | size_t strlen(const char* s); |
| 54 | |
| 55 | } // std |
| 56 | |
| 57 | */ |
| 58 | |
Louis Dionne | b4fce35 | 2022-03-25 12:55:36 -0400 | [diff] [blame] | 59 | #include <__assert> // all public C++ headers provide the assertion handler |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 60 | #include <__config> |
Louis Dionne | d3bbe79 | 2022-08-08 17:03:56 -0400 | [diff] [blame] | 61 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 62 | #include <string.h> |
| 63 | |
Louis Dionne | d3bbe79 | 2022-08-08 17:03:56 -0400 | [diff] [blame] | 64 | #ifndef _LIBCPP_STRING_H |
| 65 | # error <cstring> tried including <string.h> but didn't find libc++'s <string.h> header. \ |
| 66 | This usually means that your header search paths are not configured properly. \ |
| 67 | The header search paths should contain the C++ Standard Library headers before \ |
| 68 | any C Standard Library, and you are probably using compiler flags that make that \ |
| 69 | not be the case. |
| 70 | #endif |
| 71 | |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 72 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
Arthur O'Dwyer | 6eeaa00 | 2022-02-01 20:16:40 -0500 | [diff] [blame] | 73 | # pragma GCC system_header |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 74 | #endif |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 75 | |
| 76 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 77 | |
Louis Dionne | 9c660c6 | 2021-06-02 10:41:37 -0400 | [diff] [blame] | 78 | using ::size_t _LIBCPP_USING_IF_EXISTS; |
| 79 | using ::memcpy _LIBCPP_USING_IF_EXISTS; |
| 80 | using ::memmove _LIBCPP_USING_IF_EXISTS; |
| 81 | using ::strcpy _LIBCPP_USING_IF_EXISTS; |
| 82 | using ::strncpy _LIBCPP_USING_IF_EXISTS; |
| 83 | using ::strcat _LIBCPP_USING_IF_EXISTS; |
| 84 | using ::strncat _LIBCPP_USING_IF_EXISTS; |
| 85 | using ::memcmp _LIBCPP_USING_IF_EXISTS; |
| 86 | using ::strcmp _LIBCPP_USING_IF_EXISTS; |
| 87 | using ::strncmp _LIBCPP_USING_IF_EXISTS; |
| 88 | using ::strcoll _LIBCPP_USING_IF_EXISTS; |
| 89 | using ::strxfrm _LIBCPP_USING_IF_EXISTS; |
| 90 | using ::memchr _LIBCPP_USING_IF_EXISTS; |
| 91 | using ::strchr _LIBCPP_USING_IF_EXISTS; |
| 92 | using ::strcspn _LIBCPP_USING_IF_EXISTS; |
| 93 | using ::strpbrk _LIBCPP_USING_IF_EXISTS; |
| 94 | using ::strrchr _LIBCPP_USING_IF_EXISTS; |
| 95 | using ::strspn _LIBCPP_USING_IF_EXISTS; |
| 96 | using ::strstr _LIBCPP_USING_IF_EXISTS; |
Louis Dionne | 9c660c6 | 2021-06-02 10:41:37 -0400 | [diff] [blame] | 97 | using ::strtok _LIBCPP_USING_IF_EXISTS; |
Louis Dionne | 9c660c6 | 2021-06-02 10:41:37 -0400 | [diff] [blame] | 98 | using ::memset _LIBCPP_USING_IF_EXISTS; |
| 99 | using ::strerror _LIBCPP_USING_IF_EXISTS; |
| 100 | using ::strlen _LIBCPP_USING_IF_EXISTS; |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 101 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 102 | _LIBCPP_END_NAMESPACE_STD |
| 103 | |
Louis Dionne | 2b1ceaa | 2021-04-20 12:03:32 -0400 | [diff] [blame] | 104 | #endif // _LIBCPP_CSTRING |