Home | History | Annotate | Line # | Download | only in include
      1  1.1  joerg // -*- C++ -*-
      2  1.1  joerg //===--------------------------- string.h ---------------------------------===//
      3  1.1  joerg //
      4  1.1  joerg // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
      5  1.1  joerg // See https://llvm.org/LICENSE.txt for license information.
      6  1.1  joerg // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
      7  1.1  joerg //
      8  1.1  joerg //===----------------------------------------------------------------------===//
      9  1.1  joerg 
     10  1.1  joerg #ifndef _LIBCPP_STRING_H
     11  1.1  joerg #define _LIBCPP_STRING_H
     12  1.1  joerg 
     13  1.1  joerg /*
     14  1.1  joerg     string.h synopsis
     15  1.1  joerg 
     16  1.1  joerg Macros:
     17  1.1  joerg 
     18  1.1  joerg     NULL
     19  1.1  joerg 
     20  1.1  joerg Types:
     21  1.1  joerg 
     22  1.1  joerg     size_t
     23  1.1  joerg 
     24  1.1  joerg void* memcpy(void* restrict s1, const void* restrict s2, size_t n);
     25  1.1  joerg void* memmove(void* s1, const void* s2, size_t n);
     26  1.1  joerg char* strcpy (char* restrict s1, const char* restrict s2);
     27  1.1  joerg char* strncpy(char* restrict s1, const char* restrict s2, size_t n);
     28  1.1  joerg char* strcat (char* restrict s1, const char* restrict s2);
     29  1.1  joerg char* strncat(char* restrict s1, const char* restrict s2, size_t n);
     30  1.1  joerg int memcmp(const void* s1, const void* s2, size_t n);
     31  1.1  joerg int strcmp (const char* s1, const char* s2);
     32  1.1  joerg int strncmp(const char* s1, const char* s2, size_t n);
     33  1.1  joerg int strcoll(const char* s1, const char* s2);
     34  1.1  joerg size_t strxfrm(char* restrict s1, const char* restrict s2, size_t n);
     35  1.1  joerg const void* memchr(const void* s, int c, size_t n);
     36  1.1  joerg       void* memchr(      void* s, int c, size_t n);
     37  1.1  joerg const char* strchr(const char* s, int c);
     38  1.1  joerg       char* strchr(      char* s, int c);
     39  1.1  joerg size_t strcspn(const char* s1, const char* s2);
     40  1.1  joerg const char* strpbrk(const char* s1, const char* s2);
     41  1.1  joerg       char* strpbrk(      char* s1, const char* s2);
     42  1.1  joerg const char* strrchr(const char* s, int c);
     43  1.1  joerg       char* strrchr(      char* s, int c);
     44  1.1  joerg size_t strspn(const char* s1, const char* s2);
     45  1.1  joerg const char* strstr(const char* s1, const char* s2);
     46  1.1  joerg       char* strstr(      char* s1, const char* s2);
     47  1.1  joerg char* strtok(char* restrict s1, const char* restrict s2);
     48  1.1  joerg void* memset(void* s, int c, size_t n);
     49  1.1  joerg char* strerror(int errnum);
     50  1.1  joerg size_t strlen(const char* s);
     51  1.1  joerg 
     52  1.1  joerg */
     53  1.1  joerg 
     54  1.1  joerg #include <__config>
     55  1.1  joerg 
     56  1.1  joerg #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
     57  1.1  joerg #pragma GCC system_header
     58  1.1  joerg #endif
     59  1.1  joerg 
     60  1.1  joerg #include_next <string.h>
     61  1.1  joerg 
     62  1.1  joerg // MSVCRT, GNU libc and its derivates may already have the correct prototype in
     63  1.1  joerg // <string.h>. This macro can be defined by users if their C library provides
     64  1.1  joerg // the right signature.
     65  1.1  joerg #if defined(__CORRECT_ISO_CPP_STRING_H_PROTO) || defined(_LIBCPP_MSVCRT) || \
     66  1.1  joerg     defined(__sun__) || defined(_STRING_H_CPLUSPLUS_98_CONFORMANCE_)
     67  1.1  joerg #define _LIBCPP_STRING_H_HAS_CONST_OVERLOADS
     68  1.1  joerg #endif
     69  1.1  joerg 
     70  1.1  joerg #if defined(__cplusplus) && !defined(_LIBCPP_STRING_H_HAS_CONST_OVERLOADS) && defined(_LIBCPP_PREFERRED_OVERLOAD)
     71  1.1  joerg extern "C++" {
     72  1.1  joerg inline _LIBCPP_INLINE_VISIBILITY
     73  1.1  joerg char* __libcpp_strchr(const char* __s, int __c) {return (char*)strchr(__s, __c);}
     74  1.1  joerg inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
     75  1.1  joerg const char* strchr(const char* __s, int __c) {return __libcpp_strchr(__s, __c);}
     76  1.1  joerg inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
     77  1.1  joerg       char* strchr(      char* __s, int __c) {return __libcpp_strchr(__s, __c);}
     78  1.1  joerg 
     79  1.1  joerg inline _LIBCPP_INLINE_VISIBILITY
     80  1.1  joerg char* __libcpp_strpbrk(const char* __s1, const char* __s2) {return (char*)strpbrk(__s1, __s2);}
     81  1.1  joerg inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
     82  1.1  joerg const char* strpbrk(const char* __s1, const char* __s2) {return __libcpp_strpbrk(__s1, __s2);}
     83  1.1  joerg inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
     84  1.1  joerg       char* strpbrk(      char* __s1, const char* __s2) {return __libcpp_strpbrk(__s1, __s2);}
     85  1.1  joerg 
     86  1.1  joerg inline _LIBCPP_INLINE_VISIBILITY
     87  1.1  joerg char* __libcpp_strrchr(const char* __s, int __c) {return (char*)strrchr(__s, __c);}
     88  1.1  joerg inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
     89  1.1  joerg const char* strrchr(const char* __s, int __c) {return __libcpp_strrchr(__s, __c);}
     90  1.1  joerg inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
     91  1.1  joerg       char* strrchr(      char* __s, int __c) {return __libcpp_strrchr(__s, __c);}
     92  1.1  joerg 
     93  1.1  joerg inline _LIBCPP_INLINE_VISIBILITY
     94  1.1  joerg void* __libcpp_memchr(const void* __s, int __c, size_t __n) {return (void*)memchr(__s, __c, __n);}
     95  1.1  joerg inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
     96  1.1  joerg const void* memchr(const void* __s, int __c, size_t __n) {return __libcpp_memchr(__s, __c, __n);}
     97  1.1  joerg inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
     98  1.1  joerg       void* memchr(      void* __s, int __c, size_t __n) {return __libcpp_memchr(__s, __c, __n);}
     99  1.1  joerg 
    100  1.1  joerg inline _LIBCPP_INLINE_VISIBILITY
    101  1.1  joerg char* __libcpp_strstr(const char* __s1, const char* __s2) {return (char*)strstr(__s1, __s2);}
    102  1.1  joerg inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
    103  1.1  joerg const char* strstr(const char* __s1, const char* __s2) {return __libcpp_strstr(__s1, __s2);}
    104  1.1  joerg inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
    105  1.1  joerg       char* strstr(      char* __s1, const char* __s2) {return __libcpp_strstr(__s1, __s2);}
    106  1.1  joerg }
    107  1.1  joerg #endif
    108  1.1  joerg 
    109  1.1  joerg #endif // _LIBCPP_STRING_H
    110