1303237Sdim// -*- C++ -*-
2303237Sdim//===--------------------------- string.h ---------------------------------===//
3303237Sdim//
4353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5353358Sdim// See https://llvm.org/LICENSE.txt for license information.
6353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7303237Sdim//
8303237Sdim//===----------------------------------------------------------------------===//
9303237Sdim
10303237Sdim#ifndef _LIBCPP_STRING_H
11303237Sdim#define _LIBCPP_STRING_H
12303237Sdim
13303237Sdim/*
14303237Sdim    string.h synopsis
15303237Sdim
16303237SdimMacros:
17303237Sdim
18303237Sdim    NULL
19303237Sdim
20303237SdimTypes:
21303237Sdim
22303237Sdim    size_t
23303237Sdim
24303237Sdimvoid* memcpy(void* restrict s1, const void* restrict s2, size_t n);
25303237Sdimvoid* memmove(void* s1, const void* s2, size_t n);
26303237Sdimchar* strcpy (char* restrict s1, const char* restrict s2);
27303237Sdimchar* strncpy(char* restrict s1, const char* restrict s2, size_t n);
28303237Sdimchar* strcat (char* restrict s1, const char* restrict s2);
29303237Sdimchar* strncat(char* restrict s1, const char* restrict s2, size_t n);
30303237Sdimint memcmp(const void* s1, const void* s2, size_t n);
31303237Sdimint strcmp (const char* s1, const char* s2);
32303237Sdimint strncmp(const char* s1, const char* s2, size_t n);
33303237Sdimint strcoll(const char* s1, const char* s2);
34303237Sdimsize_t strxfrm(char* restrict s1, const char* restrict s2, size_t n);
35303237Sdimconst void* memchr(const void* s, int c, size_t n);
36303237Sdim      void* memchr(      void* s, int c, size_t n);
37303237Sdimconst char* strchr(const char* s, int c);
38303237Sdim      char* strchr(      char* s, int c);
39303237Sdimsize_t strcspn(const char* s1, const char* s2);
40303237Sdimconst char* strpbrk(const char* s1, const char* s2);
41303237Sdim      char* strpbrk(      char* s1, const char* s2);
42303237Sdimconst char* strrchr(const char* s, int c);
43303237Sdim      char* strrchr(      char* s, int c);
44303237Sdimsize_t strspn(const char* s1, const char* s2);
45303237Sdimconst char* strstr(const char* s1, const char* s2);
46303237Sdim      char* strstr(      char* s1, const char* s2);
47303237Sdimchar* strtok(char* restrict s1, const char* restrict s2);
48303237Sdimvoid* memset(void* s, int c, size_t n);
49303237Sdimchar* strerror(int errnum);
50303237Sdimsize_t strlen(const char* s);
51303237Sdim
52303237Sdim*/
53303237Sdim
54303237Sdim#include <__config>
55303237Sdim
56303237Sdim#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
57303237Sdim#pragma GCC system_header
58303237Sdim#endif
59303237Sdim
60303237Sdim#include_next <string.h>
61303237Sdim
62303237Sdim// MSVCRT, GNU libc and its derivates may already have the correct prototype in
63303237Sdim// <string.h>. This macro can be defined by users if their C library provides
64303237Sdim// the right signature.
65303237Sdim#if defined(__CORRECT_ISO_CPP_STRING_H_PROTO) || defined(_LIBCPP_MSVCRT) || \
66303237Sdim    defined(__sun__) || defined(_STRING_H_CPLUSPLUS_98_CONFORMANCE_)
67303237Sdim#define _LIBCPP_STRING_H_HAS_CONST_OVERLOADS
68303237Sdim#endif
69303237Sdim
70303237Sdim#if defined(__cplusplus) && !defined(_LIBCPP_STRING_H_HAS_CONST_OVERLOADS) && defined(_LIBCPP_PREFERRED_OVERLOAD)
71303237Sdimextern "C++" {
72303237Sdiminline _LIBCPP_INLINE_VISIBILITY
73303237Sdimchar* __libcpp_strchr(const char* __s, int __c) {return (char*)strchr(__s, __c);}
74303237Sdiminline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
75303237Sdimconst char* strchr(const char* __s, int __c) {return __libcpp_strchr(__s, __c);}
76303237Sdiminline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
77303237Sdim      char* strchr(      char* __s, int __c) {return __libcpp_strchr(__s, __c);}
78303237Sdim
79303237Sdiminline _LIBCPP_INLINE_VISIBILITY
80303237Sdimchar* __libcpp_strpbrk(const char* __s1, const char* __s2) {return (char*)strpbrk(__s1, __s2);}
81303237Sdiminline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
82303237Sdimconst char* strpbrk(const char* __s1, const char* __s2) {return __libcpp_strpbrk(__s1, __s2);}
83303237Sdiminline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
84303237Sdim      char* strpbrk(      char* __s1, const char* __s2) {return __libcpp_strpbrk(__s1, __s2);}
85303237Sdim
86303237Sdiminline _LIBCPP_INLINE_VISIBILITY
87303237Sdimchar* __libcpp_strrchr(const char* __s, int __c) {return (char*)strrchr(__s, __c);}
88303237Sdiminline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
89303237Sdimconst char* strrchr(const char* __s, int __c) {return __libcpp_strrchr(__s, __c);}
90303237Sdiminline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
91303237Sdim      char* strrchr(      char* __s, int __c) {return __libcpp_strrchr(__s, __c);}
92303237Sdim
93303237Sdiminline _LIBCPP_INLINE_VISIBILITY
94303237Sdimvoid* __libcpp_memchr(const void* __s, int __c, size_t __n) {return (void*)memchr(__s, __c, __n);}
95303237Sdiminline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
96303237Sdimconst void* memchr(const void* __s, int __c, size_t __n) {return __libcpp_memchr(__s, __c, __n);}
97303237Sdiminline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
98303237Sdim      void* memchr(      void* __s, int __c, size_t __n) {return __libcpp_memchr(__s, __c, __n);}
99303237Sdim
100303237Sdiminline _LIBCPP_INLINE_VISIBILITY
101303237Sdimchar* __libcpp_strstr(const char* __s1, const char* __s2) {return (char*)strstr(__s1, __s2);}
102303237Sdiminline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
103303237Sdimconst char* strstr(const char* __s1, const char* __s2) {return __libcpp_strstr(__s1, __s2);}
104303237Sdiminline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
105303237Sdim      char* strstr(      char* __s1, const char* __s2) {return __libcpp_strstr(__s1, __s2);}
106303237Sdim}
107303237Sdim#endif
108303237Sdim
109303237Sdim#endif  // _LIBCPP_STRING_H
110