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