]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cstring (memchr, [...]): Provide inlines only if __CORRECT_ISO_CPP_STRING_H_PROTO...
authorUlrich Drepper <drepper@redhat.com>
Fri, 30 Jan 2009 00:08:29 +0000 (00:08 +0000)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 30 Jan 2009 00:08:29 +0000 (01:08 +0100)
* 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

libstdc++-v3/ChangeLog
libstdc++-v3/include/c_global/cstring
libstdc++-v3/include/c_global/cwchar
libstdc++-v3/include/c_std/cstring
libstdc++-v3/include/c_std/cwchar
libstdc++-v3/testsuite/21_strings/c_strings/char/2.cc
libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/2.cc

index 06472ac6252b7134050766a44ca465cda2c76f92..3fb9031007a7804baa083a044292aa6f1320a292 100644 (file)
@@ -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.
index 9ad0683422f26c3ebb7bd8ded426367da41cf885..5035e4c1279bc9f817b7cebad915fe1c8653097e 100644 (file)
@@ -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
 
index 48b901ddd61e968f0e9ea9b178faf82e6ad8296b..7284f3df9d49af9977bc0a958c279ab46142f872 100644 (file)
@@ -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
 
index 5fef6b0086e65d45249d413ee1a752cc1df83878..608e219cd7fc2e39af6c4c42620ffed777acf81f 100644 (file)
@@ -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
 
index 19ce17deceb06580d2249192fe136d7b9a3ec1af..a6ffe0ab466750174cfc6e6eff8badc23b0e8559 100644 (file)
@@ -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
 
index 51e8826aeab056dfd9d976f76b1ef94236dcb54d..ab1e5b0b05f1bd7d30ece478b932038378de6bb1 100644 (file)
@@ -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);
 }
 
index 67d9d84aedf573370bc515bad1322c25d685367e..aefc1a784e332055935159ba95ed2ecdda186844 100644 (file)
@@ -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);
 }