aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Kosnik <bkoz@gcc.gnu.org>2001-05-22 04:58:45 +0000
committerBenjamin Kosnik <bkoz@gcc.gnu.org>2001-05-22 04:58:45 +0000
commit9ea659ac82ee639346acbf3c6ba2dff18d63c514 (patch)
tree6dd4188c2950851f31a672cd6c3106a05203b43f
parentd4fae8b1f00a33a5a3081d0ec7259ed95b74d806 (diff)
downloadgcc-9ea659ac82ee639346acbf3c6ba2dff18d63c514.zip
gcc-9ea659ac82ee639346acbf3c6ba2dff18d63c514.tar.gz
gcc-9ea659ac82ee639346acbf3c6ba2dff18d63c514.tar.bz2
std_cstring.h (memchr): Define "C" functions to __glibcpp_memchr.
2001-05-21 Stephen M. Webb <stephen@bregmasoft.com> * include/c_std/bits/std_cstring.h (memchr): Define "C" functions to __glibcpp_memchr. (strchr): Same, but to __glibcpp_strchr. (strpbrk): Same. (strrchr): Same. (strstr): Same. * include/c_std/bits/std_cwchar.h (wcschr): Same. (wcsbrk): Same. (wcsrchr): Same. (wcsstr): Same. (wmemchr): Same. From-SVN: r42421
-rw-r--r--libstdc++-v3/ChangeLog18
-rw-r--r--libstdc++-v3/include/c_std/bits/std_cstring.h61
-rw-r--r--libstdc++-v3/include/c_std/bits/std_cwchar.h61
3 files changed, 73 insertions, 67 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index b64845f..af79841 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,21 @@
+2001-05-21 Stephen M. Webb <stephen@bregmasoft.com>
+
+ * include/c_std/bits/std_cstring.h (memchr): Define "C" functions to
+ __glibcpp_memchr.
+ (strchr): Same, but to __glibcpp_strchr.
+ (strpbrk): Same.
+ (strrchr): Same.
+ (strstr): Same.
+ * include/c_std/bits/std_cwchar.h (wcschr): Same.
+ (wcsbrk): Same.
+ (wcsrchr): Same.
+ (wcsstr): Same.
+ (wmemchr): Same.
+
+2001-05-21 Benjamin Kosnik <bkoz@kredhat.com>
+
+ * testsuite/21_strings/c_strings.cc (main): Fix.
+
2001-05-19 Phil Edwards <pme@sources.redhat.com>
* acinclude.m4: Fix --help spacing, correct comments.
diff --git a/libstdc++-v3/include/c_std/bits/std_cstring.h b/libstdc++-v3/include/c_std/bits/std_cstring.h
index 0134eb2..02b7cda 100644
--- a/libstdc++-v3/include/c_std/bits/std_cstring.h
+++ b/libstdc++-v3/include/c_std/bits/std_cstring.h
@@ -39,6 +39,14 @@
#include <bits/c++config.h>
#include <bits/std_cstddef.h>
+
+// Need to mangle these "C" functions because C++ modifies their signature.
+#define memchr __glibcpp_memchr
+#define strchr __glibcpp_strchr
+#define strpbrk __glibcpp_strpbrk
+#define strrchr __glibcpp_strrchr
+#define strstr __glibcpp_strstr
+
#pragma GCC system_header
#include <string.h>
@@ -79,51 +87,38 @@ namespace std
extern "C" int strcoll(const char*, const char*);
extern "C" int strncmp(const char*, const char*, size_t);
extern "C" size_t strxfrm(char*, const char*, size_t);
-
- inline const void*
- memchr(const void* __p, int __c, size_t __n)
- { return const_cast<const void*>(::memchr(__p, __c, __n)); }
-
+ extern "C" const void* memchr(const void*, int, size_t);
inline void*
memchr(void* __p, int __c, size_t __n)
- { return ::memchr(const_cast<const void*>(__p), __c, __n); }
-
- inline const char*
- strchr(const char* __s1, int __n)
- { return const_cast<const char*>(::strchr(__s1, __n)); }
-
+ {
+ return const_cast<void*>(memchr(const_cast<const void*>(__p), __c, __n));
+ }
+ extern "C" const char* strchr(const char*, int);
inline char*
strchr(char* __s1, int __n)
- { return ::strchr(const_cast<const char*>(__s1), __n); }
-
+ {
+ return const_cast<char*>(strchr(const_cast<const char*>(__s1), __n));
+ }
extern "C" size_t strcspn(const char*, const char*);
-
- inline const char*
- strpbrk(const char* __s1, const char* __s2)
- { return const_cast<char*>(::strpbrk(__s1, __s2)); }
-
+ extern "C" const char* strpbrk(const char*, const char*);
inline char*
strpbrk(char* __s1, const char* __s2)
- { return ::strpbrk(const_cast<const char*>(__s1), __s2); }
-
- inline const char*
- strrchr(const char* __s1, int __n)
- { return const_cast<char*>(::strrchr(__s1, __n)); }
-
+ {
+ return const_cast<char*>(strpbrk(const_cast<const char*>(__s1), __s2));
+ }
+ extern "C" const char* strrchr(const char*, int);
inline char*
strrchr(char* __s1, int __n)
- { return ::strrchr(const_cast<const char*>(__s1), __n); }
-
+ {
+ return const_cast<char*>(strrchr(const_cast<const char*>(__s1), __n));
+ }
extern "C" size_t strspn(const char*, const char*);
-
- inline const char*
- strstr(const char* __s1, const char* __s2)
- { return const_cast<char*>(::strstr(__s1, __s2)); }
-
+ extern "C" const char* strstr(const char*, const char*);
inline char*
strstr(char* __s1, const char* __s2)
- { return ::strstr(const_cast<const char*>(__s1), __s2); }
-
+ {
+ return const_cast<char*>(strstr(const_cast<const char*>(__s1), __s2));
+ }
extern "C" char* strtok(char*, const char*);
extern "C" void* memset(void*, int, size_t);
extern "C" char* strerror(int);
diff --git a/libstdc++-v3/include/c_std/bits/std_cwchar.h b/libstdc++-v3/include/c_std/bits/std_cwchar.h
index 2765935..d3fe012 100644
--- a/libstdc++-v3/include/c_std/bits/std_cwchar.h
+++ b/libstdc++-v3/include/c_std/bits/std_cwchar.h
@@ -42,6 +42,13 @@
#include <bits/std_cstdarg.h>
#if _GLIBCPP_HAVE_WCHAR_H
+// Need to mangle these "C" functions because C++ modifies their signature.
+#define wcschr __glibcpp_wcschr
+#define wcsbrk __glibcpp_wcspbrk
+#define wcsrchr __glibcpp_wcsrchr
+#define wcsstr __glibcpp_wcsstr
+#define wmemchr __glibcpp_wmemchr
+
#pragma GCC system_header
#include <wchar.h>
#endif
@@ -156,54 +163,40 @@ namespace std
extern "C" int wcscoll(const wchar_t*, const wchar_t*);
extern "C" int wcsncmp(const wchar_t*, const wchar_t*, size_t);
extern "C" size_t wcsxfrm(wchar_t*, const wchar_t*, size_t);
-
- inline const wchar_t*
- wcschr(const wchar_t* __p, wchar_t __c)
- { return const_cast<const wchar_t*>(::wcschr(__p, __c)); }
-
+ extern "C" const wchar_t* wcschr(const wchar_t*, wchar_t);
inline wchar_t*
wcschr(wchar_t* __p, wchar_t __c)
- { return ::wcschr(const_cast<const wchar_t*>(__p), __c); }
-
+ {
+ return const_cast<wchar_t*>(wcschr(const_cast<const wchar_t*>(__p), __c));
+ }
extern "C" size_t wcscspn(const wchar_t*, const wchar_t*);
extern "C" size_t wcslen(const wchar_t*);
-
- inline const wchar_t*
- wcspbrk(const wchar_t* __s1, wchar_t* __s2)
- { return const_cast<const wchar_t*>(::wcspbrk(__s1, __s2)); }
-
+ extern "C" const wchar_t* wcspbrk(const wchar_t*, const wchar_t*);
inline wchar_t*
wcspbrk(wchar_t* __s1, wchar_t* __s2)
- { return ::wcspbrk(const_cast<const wchar_t*>(__s1), __s2); }
-
- inline const wchar_t*
- wcsrchr(const wchar_t* __p, wchar_t __c)
- { return const_cast<const wchar_t*>(::wcsrchr(__p, __c)); }
-
+ {
+ return const_cast<wchar_t*>(wcspbrk(const_cast<const wchar_t*>(__s1), __s2));
+ }
+ extern "C" const wchar_t* wcsrchr(const wchar_t*, wchar_t);
inline wchar_t*
wcsrchr(wchar_t* __p, wchar_t __c)
- { return ::wcsrchr(const_cast<const wchar_t*>(__p), __c); }
-
+ {
+ return const_cast<wchar_t*>(wcsrchr(const_cast<const wchar_t*>(__p), __c));
+ }
extern "C" size_t wcsspn(const wchar_t*, const wchar_t*);
-
- inline const wchar_t*
- wcsstr(const wchar_t* __s1, wchar_t* __s2)
- { return const_cast<const wchar_t*>(::wcsstr(__s1, __s2)); }
-
+ extern "C" const wchar_t* wcsstr(const wchar_t*, const wchar_t*);
inline wchar_t*
wcsstr(wchar_t* __s1, wchar_t* __s2)
- { return ::wcsstr(const_cast<const wchar_t*>(__s1), __s2); }
-
+ {
+ return const_cast<wchar_t*>(wcsstr(const_cast<const wchar_t*>(__s1), __s2));
+ }
extern "C" wchar_t* wcstok(wchar_t*, const wchar_t*, wchar_t**);
-
- inline const wchar_t*
- wmemchr(const wchar_t* __p, wchar_t __c, size_t __n)
- { return const_cast<wchar_t*>(::wmemchr(__p, __c, __n)); }
-
+ extern "C" const wchar_t* wmemchr(const wchar_t*, wchar_t, size_t);
inline wchar_t*
wmemchr(wchar_t* __p, wchar_t __c, size_t __n)
- { return ::wmemchr(const_cast<const wchar_t*>(__p), __c, __n); }
-
+ {
+ return const_cast<wchar_t*>(wmemchr(const_cast<const wchar_t*>(__p), __c, __n));
+ }
extern "C" int wmemcmp(const wchar_t*, const wchar_t*, size_t);
extern "C" wchar_t* wmemcpy(wchar_t*, const wchar_t*, size_t);
extern "C" wchar_t* wmemmove(wchar_t*, const wchar_t*, size_t);