diff options
author | Ulrich Drepper <drepper@redhat.com> | 2009-01-30 00:08:29 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2009-01-30 01:08:29 +0100 |
commit | 60822e0b57d2b5303fdfb5af829fb4dcf77626f1 (patch) | |
tree | 4062f59ed38873a74525cac1bcb73d7b5bb59f8a /libstdc++-v3 | |
parent | cbdab9c897d52b8311979a1e31e41d248671a4cb (diff) | |
download | gcc-60822e0b57d2b5303fdfb5af829fb4dcf77626f1.zip gcc-60822e0b57d2b5303fdfb5af829fb4dcf77626f1.tar.gz gcc-60822e0b57d2b5303fdfb5af829fb4dcf77626f1.tar.bz2 |
cstring (memchr, [...]): Provide inlines only if __CORRECT_ISO_CPP_STRING_H_PROTO is not defined.
* include/c_std/cstring (memchr, strchr, strpbrk, strrchr, strstr):
Provide inlines only if __CORRECT_ISO_CPP_STRING_H_PROTO is not
defined.
* include/c_std/cwchar (wcschr, wcspbrk, wcsrchr, wcsstr, wmemchr):
Provide inlines only if __CORRECT_ISO_CPP_WCHAR_H_PROTO is not
defined.
* include/c_global/cstring (memchr, strchr, strpbrk, strrchr, strstr):
Provide inlines only if __CORRECT_ISO_CPP_STRING_H_PROTO is not
defined.
* include/c_global/cwchar (wcschr, wcspbrk, wcsrchr, wcsstr, wmemchr):
Provide inlines only if __CORRECT_ISO_CPP_WCHAR_H_PROTO is not
defined.
* testsuite/21_strings/c_strings/char_t/2.cc (test02): If first
argument is const char *, assign result to const char * var, not
char *.
* testsuite/21_strings/c_strings/wchar_t/2.cc (test02): If first
argument is const wchar_t *, assign result to const wchar_t * var, not
wchar_t *.
Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
From-SVN: r143773
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 22 | ||||
-rw-r--r-- | libstdc++-v3/include/c_global/cstring | 16 | ||||
-rw-r--r-- | libstdc++-v3/include/c_global/cwchar | 17 | ||||
-rw-r--r-- | libstdc++-v3/include/c_std/cstring | 17 | ||||
-rw-r--r-- | libstdc++-v3/include/c_std/cwchar | 17 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/21_strings/c_strings/char/2.cc | 13 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/2.cc | 11 |
7 files changed, 63 insertions, 50 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 06472ac..3fb90310 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,25 @@ +2009-01-30 Ulrich Drepper <drepper@redhat.com> + Jakub Jelinek <jakub@redhat.com> + + * include/c_std/cstring (memchr, strchr, strpbrk, strrchr, strstr): + Provide inlines only if __CORRECT_ISO_CPP_STRING_H_PROTO is not + defined. + * include/c_std/cwchar (wcschr, wcspbrk, wcsrchr, wcsstr, wmemchr): + Provide inlines only if __CORRECT_ISO_CPP_WCHAR_H_PROTO is not + defined. + * include/c_global/cstring (memchr, strchr, strpbrk, strrchr, strstr): + Provide inlines only if __CORRECT_ISO_CPP_STRING_H_PROTO is not + defined. + * include/c_global/cwchar (wcschr, wcspbrk, wcsrchr, wcsstr, wmemchr): + Provide inlines only if __CORRECT_ISO_CPP_WCHAR_H_PROTO is not + defined. + * testsuite/21_strings/c_strings/char_t/2.cc (test02): If first + argument is const char *, assign result to const char * var, not + char *. + * testsuite/21_strings/c_strings/wchar_t/2.cc (test02): If first + argument is const wchar_t *, assign result to const wchar_t * var, not + wchar_t *. + 2009-01-29 Jonathan Wakely <jwakely.gcc@gmail.com> * include/std/thread: Remove unused headers. diff --git a/libstdc++-v3/include/c_global/cstring b/libstdc++-v3/include/c_global/cstring index 9ad0683..5035e4c 100644 --- a/libstdc++-v3/include/c_global/cstring +++ b/libstdc++-v3/include/c_global/cstring @@ -1,7 +1,7 @@ // -*- C++ -*- forwarding header. // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, -// 2006, 2007, 2008 +// 2006, 2007, 2008, 2009 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -96,34 +96,32 @@ _GLIBCXX_BEGIN_NAMESPACE(std) using ::strspn; using ::strtok; using ::strxfrm; + using ::strchr; + using ::strpbrk; + using ::strrchr; + using ::strstr; +#ifndef __CORRECT_ISO_CPP_STRING_H_PROTO inline void* memchr(void* __p, int __c, size_t __n) { return memchr(const_cast<const void*>(__p), __c, __n); } - using ::strchr; - inline char* strchr(char* __s1, int __n) { return __builtin_strchr(const_cast<const char*>(__s1), __n); } - using ::strpbrk; - inline char* strpbrk(char* __s1, const char* __s2) { return __builtin_strpbrk(const_cast<const char*>(__s1), __s2); } - using ::strrchr; - inline char* strrchr(char* __s1, int __n) { return __builtin_strrchr(const_cast<const char*>(__s1), __n); } - using ::strstr; - inline char* strstr(char* __s1, const char* __s2) { return __builtin_strstr(const_cast<const char*>(__s1), __s2); } +#endif _GLIBCXX_END_NAMESPACE diff --git a/libstdc++-v3/include/c_global/cwchar b/libstdc++-v3/include/c_global/cwchar index 48b901d..7284f3d 100644 --- a/libstdc++-v3/include/c_global/cwchar +++ b/libstdc++-v3/include/c_global/cwchar @@ -1,7 +1,7 @@ // -*- C++ -*- forwarding header. // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, -// 2006, 2007, 2008 +// 2006, 2007, 2008, 2009 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -204,36 +204,33 @@ _GLIBCXX_BEGIN_NAMESPACE(std) using ::wmemset; using ::wprintf; using ::wscanf; - using ::wcschr; + using ::wcspbrk; + using ::wcsrchr; + using ::wcsstr; + using ::wmemchr; +#ifndef __CORRECT_ISO_CPP_WCHAR_H_PROTO inline wchar_t* wcschr(wchar_t* __p, wchar_t __c) { return wcschr(const_cast<const wchar_t*>(__p), __c); } - using ::wcspbrk; - inline wchar_t* wcspbrk(wchar_t* __s1, const wchar_t* __s2) { return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); } - using ::wcsrchr; - inline wchar_t* wcsrchr(wchar_t* __p, wchar_t __c) { return wcsrchr(const_cast<const wchar_t*>(__p), __c); } - using ::wcsstr; - inline wchar_t* wcsstr(wchar_t* __s1, const wchar_t* __s2) { return wcsstr(const_cast<const wchar_t*>(__s1), __s2); } - using ::wmemchr; - inline wchar_t* wmemchr(wchar_t* __p, wchar_t __c, size_t __n) { return wmemchr(const_cast<const wchar_t*>(__p), __c, __n); } +#endif _GLIBCXX_END_NAMESPACE diff --git a/libstdc++-v3/include/c_std/cstring b/libstdc++-v3/include/c_std/cstring index 5fef6b0..608e219 100644 --- a/libstdc++-v3/include/c_std/cstring +++ b/libstdc++-v3/include/c_std/cstring @@ -1,6 +1,6 @@ // -*- C++ -*- forwarding header. -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2009 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -94,36 +94,33 @@ _GLIBCXX_BEGIN_NAMESPACE(std) using ::memset; using ::strerror; using ::strlen; - using ::memchr; + using ::strchr; + using ::strpbrk; + using ::strrchr; + using ::strstr; +#ifndef __CORRECT_ISO_CPP_STRING_H_PROTO inline void* memchr(void* __p, int __c, size_t __n) { return memchr(const_cast<const void*>(__p), __c, __n); } - using ::strchr; - inline char* strchr(char* __s1, int __n) { return __builtin_strchr(const_cast<const char*>(__s1), __n); } - using ::strpbrk; - inline char* strpbrk(char* __s1, const char* __s2) { return __builtin_strpbrk(const_cast<const char*>(__s1), __s2); } - using ::strrchr; - inline char* strrchr(char* __s1, int __n) { return __builtin_strrchr(const_cast<const char*>(__s1), __n); } - using ::strstr; - inline char* strstr(char* __s1, const char* __s2) { return __builtin_strstr(const_cast<const char*>(__s1), __s2); } +#endif _GLIBCXX_END_NAMESPACE diff --git a/libstdc++-v3/include/c_std/cwchar b/libstdc++-v3/include/c_std/cwchar index 19ce17d..a6ffe0a 100644 --- a/libstdc++-v3/include/c_std/cwchar +++ b/libstdc++-v3/include/c_std/cwchar @@ -1,7 +1,7 @@ // -*- C++ -*- forwarding header. // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, -// 2006, 2007 +// 2006, 2007, 2009 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -204,36 +204,33 @@ _GLIBCXX_BEGIN_NAMESPACE(std) using ::wmemset; using ::wprintf; using ::wscanf; - using ::wcschr; + using ::wcspbrk; + using ::wcsrchr; + using ::wcsstr; + using ::wmemchr; +#ifndef __CORRECT_ISO_CPP_WCHAR_H_PROTO inline wchar_t* wcschr(wchar_t* __p, wchar_t __c) { return wcschr(const_cast<const wchar_t*>(__p), __c); } - using ::wcspbrk; - inline wchar_t* wcspbrk(wchar_t* __s1, const wchar_t* __s2) { return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); } - using ::wcsrchr; - inline wchar_t* wcsrchr(wchar_t* __p, wchar_t __c) { return wcsrchr(const_cast<const wchar_t*>(__p), __c); } - using ::wcsstr; - inline wchar_t* wcsstr(wchar_t* __s1, const wchar_t* __s2) { return wcsstr(const_cast<const wchar_t*>(__s1), __s2); } - using ::wmemchr; - inline wchar_t* wmemchr(wchar_t* __p, wchar_t __c, size_t __n) { return wmemchr(const_cast<const wchar_t*>(__p), __c, __n); } +#endif _GLIBCXX_END_NAMESPACE diff --git a/libstdc++-v3/testsuite/21_strings/c_strings/char/2.cc b/libstdc++-v3/testsuite/21_strings/c_strings/char/2.cc index 51e8826..ab1e5b0 100644 --- a/libstdc++-v3/testsuite/21_strings/c_strings/char/2.cc +++ b/libstdc++-v3/testsuite/21_strings/c_strings/char/2.cc @@ -1,6 +1,6 @@ // 2001-04-02 Benjamin Kosnik <bkoz@redhat.com> -// Copyright (C) 2001, 2003 Free Software Foundation, Inc. +// Copyright (C) 2001, 2003, 2009 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -32,13 +32,14 @@ void test02() char carray[50]; strcpy(carray, ccarray1); const void* cv = ccarray1; - void* v; + const void* cv1; + const char* cc; char* c; - v = memchr(cv, '/', 3); - c = strchr(ccarray1, '/'); - c = strrchr(ccarray1, 'c'); - c = strpbrk(ccarray1, ccarray2); + cv1 = memchr(cv, '/', 3); + cc = strchr(ccarray1, '/'); + cc = strrchr(ccarray1, 'c'); + cc = strpbrk(ccarray1, ccarray2); c = strstr(carray, carray); } diff --git a/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/2.cc b/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/2.cc index 67d9d84..aefc1a7 100644 --- a/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/2.cc +++ b/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/2.cc @@ -1,6 +1,6 @@ // 2001-04-02 Benjamin Kosnik <bkoz@redhat.com> -// Copyright (C) 2001 Free Software Foundation, Inc. +// Copyright (C) 2001, 2009 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -32,12 +32,13 @@ void test02() const wchar_t* ccarray2 = L"san francisco sunny-day park inspectors"; wchar_t carray[50]; wcscpy(carray, ccarray1); + const wchar_t* cw; wchar_t* w; - w = wmemchr(ccarray1, L'/', 3); - w = wcschr(ccarray1, L'/'); - w = wcspbrk(ccarray1, ccarray2); - w = wcsrchr(ccarray1, L'c'); + cw = wmemchr(ccarray1, L'/', 3); + cw = wcschr(ccarray1, L'/'); + cw = wcspbrk(ccarray1, ccarray2); + cw = wcsrchr(ccarray1, L'c'); w = wcsstr(carray, carray); } |