cstring 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. // -*- C++ -*-
  2. //===----------------------------------------------------------------------===//
  3. //
  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
  7. //
  8. //===----------------------------------------------------------------------===//
  9. #ifndef _LIBCPP_CSTRING
  10. #define _LIBCPP_CSTRING
  11. /*
  12. cstring synopsis
  13. Macros:
  14. NULL
  15. namespace std
  16. {
  17. Types:
  18. size_t
  19. void* memcpy(void* restrict s1, const void* restrict s2, size_t n);
  20. void* memmove(void* s1, const void* s2, size_t n);
  21. char* strcpy (char* restrict s1, const char* restrict s2);
  22. char* strncpy(char* restrict s1, const char* restrict s2, size_t n);
  23. char* strcat (char* restrict s1, const char* restrict s2);
  24. char* strncat(char* restrict s1, const char* restrict s2, size_t n);
  25. int memcmp(const void* s1, const void* s2, size_t n);
  26. int strcmp (const char* s1, const char* s2);
  27. int strncmp(const char* s1, const char* s2, size_t n);
  28. int strcoll(const char* s1, const char* s2);
  29. size_t strxfrm(char* restrict s1, const char* restrict s2, size_t n);
  30. const void* memchr(const void* s, int c, size_t n);
  31. void* memchr( void* s, int c, size_t n);
  32. const char* strchr(const char* s, int c);
  33. char* strchr( char* s, int c);
  34. size_t strcspn(const char* s1, const char* s2);
  35. const char* strpbrk(const char* s1, const char* s2);
  36. char* strpbrk( char* s1, const char* s2);
  37. const char* strrchr(const char* s, int c);
  38. char* strrchr( char* s, int c);
  39. size_t strspn(const char* s1, const char* s2);
  40. const char* strstr(const char* s1, const char* s2);
  41. char* strstr( char* s1, const char* s2);
  42. char* strtok(char* restrict s1, const char* restrict s2);
  43. void* memset(void* s, int c, size_t n);
  44. char* strerror(int errnum);
  45. size_t strlen(const char* s);
  46. } // std
  47. */
  48. #include <__assert> // all public C++ headers provide the assertion handler
  49. #include <__config>
  50. #include <__type_traits/is_constant_evaluated.h>
  51. #include <string.h>
  52. #ifndef _LIBCPP_STRING_H
  53. # error <cstring> tried including <string.h> but didn't find libc++'s <string.h> header. \
  54. This usually means that your header search paths are not configured properly. \
  55. The header search paths should contain the C++ Standard Library headers before \
  56. any C Standard Library, and you are probably using compiler flags that make that \
  57. not be the case.
  58. #endif
  59. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  60. # pragma GCC system_header
  61. #endif
  62. _LIBCPP_BEGIN_NAMESPACE_STD
  63. using ::size_t _LIBCPP_USING_IF_EXISTS;
  64. using ::memcpy _LIBCPP_USING_IF_EXISTS;
  65. using ::memmove _LIBCPP_USING_IF_EXISTS;
  66. using ::strcpy _LIBCPP_USING_IF_EXISTS;
  67. using ::strncpy _LIBCPP_USING_IF_EXISTS;
  68. using ::strcat _LIBCPP_USING_IF_EXISTS;
  69. using ::strncat _LIBCPP_USING_IF_EXISTS;
  70. using ::memcmp _LIBCPP_USING_IF_EXISTS;
  71. using ::strcmp _LIBCPP_USING_IF_EXISTS;
  72. using ::strncmp _LIBCPP_USING_IF_EXISTS;
  73. using ::strcoll _LIBCPP_USING_IF_EXISTS;
  74. using ::strxfrm _LIBCPP_USING_IF_EXISTS;
  75. using ::memchr _LIBCPP_USING_IF_EXISTS;
  76. using ::strchr _LIBCPP_USING_IF_EXISTS;
  77. using ::strcspn _LIBCPP_USING_IF_EXISTS;
  78. using ::strpbrk _LIBCPP_USING_IF_EXISTS;
  79. using ::strrchr _LIBCPP_USING_IF_EXISTS;
  80. using ::strspn _LIBCPP_USING_IF_EXISTS;
  81. using ::strstr _LIBCPP_USING_IF_EXISTS;
  82. using ::strtok _LIBCPP_USING_IF_EXISTS;
  83. using ::memset _LIBCPP_USING_IF_EXISTS;
  84. using ::strerror _LIBCPP_USING_IF_EXISTS;
  85. using ::strlen _LIBCPP_USING_IF_EXISTS;
  86. _LIBCPP_END_NAMESPACE_STD
  87. #endif // _LIBCPP_CSTRING