xref: /netbsd-src/external/gpl3/gcc.old/dist/libstdc++-v3/include/c_std/cstring (revision b7b7574d3bf8eeb51a1fa3977b59142ec6434a55)
1// -*- C++ -*- forwarding header.
2
3// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
4// 2006, 2007, 2008, 2009, 2010
5// Free Software Foundation, Inc.
6//
7// This file is part of the GNU ISO C++ Library.  This library is free
8// software; you can redistribute it and/or modify it under the
9// terms of the GNU General Public License as published by the
10// Free Software Foundation; either version 3, or (at your option)
11// any later version.
12
13// This library is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16// GNU General Public License for more details.
17
18// Under Section 7 of GPL version 3, you are granted additional
19// permissions described in the GCC Runtime Library Exception, version
20// 3.1, as published by the Free Software Foundation.
21
22// You should have received a copy of the GNU General Public License and
23// a copy of the GCC Runtime Library Exception along with this program;
24// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
25// <http://www.gnu.org/licenses/>.
26
27/** @file cstring
28 *  This is a Standard C++ Library file.  You should @c #include this file
29 *  in your programs, rather than any of the @a *.h implementation files.
30 *
31 *  This is the C++ version of the Standard C Library header @c string.h,
32 *  and its contents are (mostly) the same as that header, but are all
33 *  contained in the namespace @c std (except for names which are defined
34 *  as macros in C).
35 */
36
37//
38// ISO C++ 14882: 20.4.6  C library
39//
40
41#ifndef _GLIBCXX_CSTRING
42#define _GLIBCXX_CSTRING 1
43
44#pragma GCC system_header
45
46#include <bits/c++config.h>
47#include <cstddef>
48#include <string.h>
49
50// Get rid of those macros defined in <string.h> in lieu of real functions.
51#undef memcpy
52#undef memmove
53#undef strcpy
54#undef strncpy
55#undef strcat
56#undef strncat
57#undef memcmp
58#undef strcmp
59#undef strcoll
60#undef strncmp
61#undef strxfrm
62#undef memchr
63#undef strchr
64#undef strcspn
65#undef strpbrk
66#undef strrchr
67#undef strspn
68#undef strstr
69#undef strtok
70#undef memset
71#undef strerror
72#undef strlen
73
74_GLIBCXX_BEGIN_NAMESPACE(std)
75
76  using ::memcpy;
77  using ::memmove;
78  using ::strcpy;
79  using ::strncpy;
80  using ::strcat;
81  using ::strncat;
82  using ::memcmp;
83  using ::strcmp;
84  using ::strcoll;
85  using ::strncmp;
86  using ::strxfrm;
87  using ::strcspn;
88  using ::strspn;
89  using ::strtok;
90  using ::memset;
91  using ::strerror;
92  using ::strlen;
93  using ::memchr;
94  using ::strchr;
95  using ::strpbrk;
96  using ::strrchr;
97  using ::strstr;
98
99#ifndef __CORRECT_ISO_CPP_STRING_H_PROTO
100  inline void*
101  memchr(void* __s, int __c, size_t __n)
102  { return __builtin_memchr(__s, __c, __n); }
103
104  inline char*
105  strchr(char* __s, int __n)
106  { return __builtin_strchr(__s, __n); }
107
108  inline char*
109  strpbrk(char* __s1, const char* __s2)
110  { return __builtin_strpbrk(__s1, __s2); }
111
112  inline char*
113  strrchr(char* __s, int __n)
114  { return __builtin_strrchr(__s, __n); }
115
116  inline char*
117  strstr(char* __s1, const char* __s2)
118  { return __builtin_strstr(__s1, __s2); }
119#endif
120
121_GLIBCXX_END_NAMESPACE
122
123#endif
124