1 // -*- C++ -*- forwarding header.
3 // Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 2, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING. If not, write to the Free
18 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
21 // As a special exception, you may use this file as part of a free software
22 // library without restriction. Specifically, if other files instantiate
23 // templates or use macros or inline functions from this file, or you compile
24 // this file and link it with other files to produce an executable, this
25 // file does not by itself cause the resulting executable to be covered by
26 // the GNU General Public License. This exception does not however
27 // invalidate any other reasons why the executable file might be covered by
28 // the GNU General Public License.
31 // ISO C++ 14882: 20.4.6 C library
34 // Note: This is not a conforming implementation.
37 #define _CPP_CSTRING 1
39 #include <bits/c++config.h>
40 #include <bits/std_cstddef.h>
43 // Need to mangle these "C" functions because C++ modifies their signature.
44 #define memcpy __glibcpp_memcpy
45 #define memmove __glibcpp_memmove
46 #define strcpy __glibcpp_strcpy
47 #define strncpy __glibcpp_strncpy
48 #define strcat __glibcpp_strcat
49 #define strncat __glibcpp_strncat
50 #define memcmp __glibcpp_memcmp
51 #define strcmp __glibcpp_strcmp
52 #define strcoll __glibcpp_strcoll
53 #define strncmp __glibcpp_strncmp
54 #define strxfrm __glibcpp_strxfrm
55 #define memchr __glibcpp_memchr
56 #define strchr __glibcpp_strchr
57 #define strcspn __glibcpp_strcspn
58 #define strpbrk __glibcpp_strpbrk
59 #define strrchr __glibcpp_strrchr
60 #define strspn __glibcpp_strspn
61 #define strstr __glibcpp_strstr
62 #define strtok __glibcpp_strtok
63 #define memset __glibcpp_memset
64 #define strerror __glibcpp_strerror
65 #define strlen __glibcpp_strlen
67 #pragma GCC system_header
70 // Get rid of those macros defined in <string.h> in lieu of real functions.
97 memcpy(void* __p1
, const void* __p2
, size_t __n
)
98 { return __builtin_memcpy(__p1
, __p2
, __n
); }
100 extern "C" void* memmove(void*, const void*, size_t);
103 strcpy(char* __s1
, const char* __s2
)
104 { return __builtin_strcpy(__s1
, __s2
); }
107 strncpy(char* __s1
, const char* __s2
, size_t __n
)
108 { return __builtin_strncpy(__s1
, __s2
, __n
); }
111 strcat(char* __s1
, const char* __s2
)
112 { return __builtin_strcat(__s1
, __s2
); }
115 strncat(char* __s1
, const char* __s2
, size_t __n
)
116 { return __builtin_strncat(__s1
, __s2
, __n
); }
119 memcmp(const void* __p1
, const void* __p2
, size_t __n
)
120 { return __builtin_memcmp(__p1
, __p2
, __n
); }
123 strcmp(const char* __s1
, const char* __s2
)
124 { return __builtin_strcmp(__s1
, __s2
); }
126 extern "C" int strcoll(const char*, const char*);
129 strncmp(const char* __s1
, const char* __s2
, size_t __n
)
130 { return __builtin_strncmp(__s1
, __s2
, __n
); }
132 extern "C" size_t strxfrm(char*, const char*, size_t);
133 extern "C" const void* memchr(const void*, int, size_t);
136 memchr(void* __p
, int __c
, size_t __n
)
138 return const_cast<void*>(memchr(const_cast<const void*>(__p
), __c
, __n
));
142 strchr(const char* __s1
, int __n
)
143 { return const_cast<const char*>(__builtin_strchr(__s1
, __n
)); }
146 strchr(char* __s1
, int __n
)
149 const_cast<char*>(__builtin_strchr(const_cast<const char*>(__s1
), __n
));
153 strcspn(const char* __s1
, const char* __s2
)
154 { return __builtin_strcspn(__s1
, __s2
); }
157 strpbrk(const char* __s1
, const char* __s2
)
158 { return const_cast<char*>(__builtin_strpbrk(__s1
, __s2
)); }
161 strpbrk(char* __s1
, const char* __s2
)
163 return const_cast<char*>
164 (__builtin_strpbrk(const_cast<const char*>(__s1
), __s2
));
168 strrchr(const char* __s1
, int __n
)
169 { return const_cast<char*>(__builtin_strrchr(__s1
, __n
)); }
172 strrchr(char* __s1
, int __n
)
173 { return __builtin_strrchr(const_cast<const char*>(__s1
), __n
); }
176 strspn(const char* __s1
, const char* __s2
)
177 { return __builtin_strspn(__s1
, __s2
); }
180 strstr(const char* __s1
, const char* __s2
)
181 { return const_cast<char*>(__builtin_strstr (__s1
, __s2
)); }
184 strstr(char* __s1
, const char* __s2
)
186 return (const_cast<char*>
187 (__builtin_strstr(const_cast<const char*>(__s1
), __s2
)));
190 extern "C" char* strtok(char*, const char*);
193 memset(void* __p
, int __c
, size_t __n
)
194 { return __builtin_memset(__p
, __c
, __n
); }
196 extern "C" char* strerror(int);
199 strlen(const char* __s
)
200 { return __builtin_strlen(__s
); }