This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[libstdc++] <cstring> fix (PRs 2767 2977 2989 2992 and others)



Here's the patch for the <cstring> and <string.h> headers to clean up the
(known) conflict, ambiguities, and missing definitions.  If results are good and
there is general agreement, this change can be extended to the other C headers.

Bootstrapped on i686-pc-linux-gnu with gcc version 3.1 20010604 (experimental).
No new testcase failures.

There should be 5 files attached to this message.  Automake will need to be run.


2001-06-05  Stephen M. Webb  <stephen@bregmasoft.com>

    PR libstdc++/2767, libstdc++/2977, libstdc++/2989, and others
    * include/c_std/bits/std_cstring.h: move function definitions out
    * include/c_std/bits/string.h: added new Appendix D header
    * src/cstring.cc: added new file for <cstring> definitions
    * src/Makefile.am: added build rules for new files
    * testsuite/21_strings/cheader_c++_c.cc: added new testcase
    * testsuite/21_strings/cheader_c_c++.cc: added new testcase

-- 

Stephen M. Webb
stephen at bregmasoft dot com

Index: libstdc++-v3/include/c_std/bits/std_cstring.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/c_std/bits/std_cstring.h,v
retrieving revision 1.9
diff -c -3 -p -r1.9 std_cstring.h
*** std_cstring.h	2001/05/25 01:33:21	1.9
--- std_cstring.h	2001/06/06 02:20:19
***************
*** 1,4 ****
! // -*- C++ -*- forwarding header.
  
  // Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
  //
--- 1,4 ----
! // -*- C++ -*- STD_CSTRING.H
  
  // Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
  //
***************
*** 28,203 ****
  // the GNU General Public License.
  
  //
! // ISO C++ 14882: 20.4.6  C library
  //
  
- // Note: This is not a conforming implementation.
- 
  #ifndef _CPP_CSTRING
  #define _CPP_CSTRING 1
  
- #include <bits/c++config.h>
- #include <bits/std_cstddef.h>
- 
- 
- // Need to mangle these "C" functions because C++ modifies their signature.
- #define memcpy __glibcpp_memcpy
- #define memmove __glibcpp_memmove
- #define strcpy __glibcpp_strcpy
- #define strncpy __glibcpp_strncpy
- #define strcat __glibcpp_strcat
- #define strncat __glibcpp_strncat
- #define memcmp __glibcpp_memcmp
- #define strcmp __glibcpp_strcmp
- #define strcoll __glibcpp_strcoll
- #define strncmp __glibcpp_strncmp
- #define strxfrm __glibcpp_strxfrm
- #define memchr __glibcpp_memchr
- #define strchr __glibcpp_strchr
- #define strcspn __glibcpp_strcspn
- #define strpbrk __glibcpp_strpbrk
- #define strrchr __glibcpp_strrchr
- #define strspn __glibcpp_strspn
- #define strstr __glibcpp_strstr
- #define strtok __glibcpp_strtok
- #define memset __glibcpp_memset
- #define strerror __glibcpp_strerror
- #define strlen __glibcpp_strlen
- 
  #pragma GCC system_header
! #include <string.h>
  
! // Get rid of those macros defined in <string.h> in lieu of real functions.
  #undef memcpy
  #undef memmove
! #undef strcpy
! #undef strncpy
  #undef strcat
! #undef strncat
! #undef memcmp
  #undef strcmp
  #undef strcoll
! #undef strncmp
! #undef strxfrm
! #undef memchr
! #undef strchr
  #undef strcspn
  #undef strpbrk
  #undef strrchr
  #undef strspn
  #undef strstr
  #undef strtok
! #undef memset
! #undef strerror
! #undef strlen
  
  namespace std 
  {
!   inline void*
!   memcpy(void* __p1, const void* __p2, size_t __n)
!   { return __builtin_memcpy(__p1, __p2, __n); }
! 
!   extern "C" void* memmove(void*, const void*, size_t); 
! 
!   inline char*
!   strcpy(char* __s1, const char* __s2)
!   { return __builtin_strcpy(__s1, __s2); }
! 
!   inline char*
!   strncpy(char* __s1, const char* __s2, size_t __n)
!   { return __builtin_strncpy(__s1, __s2, __n); }
! 
!   inline char*
!   strcat(char* __s1, const char* __s2)
!   { return __builtin_strcat(__s1, __s2); }
! 
!   inline char*
!   strncat(char* __s1, const char* __s2, size_t __n)
!   { return __builtin_strncat(__s1, __s2, __n); }
! 
!   inline int
!   memcmp(const void* __p1, const void* __p2, size_t __n)
!   { return __builtin_memcmp(__p1, __p2, __n); }
! 
!   inline int
!   strcmp(const char* __s1, const char* __s2)
!   { return __builtin_strcmp(__s1, __s2); }
! 
!   extern "C" int strcoll(const char*, const char*); 
! 
!   inline int
!   strncmp(const char* __s1, const char* __s2, size_t __n)
!   { return __builtin_strncmp(__s1, __s2, __n); }
! 
!   extern "C" size_t strxfrm(char*, const char*, size_t); 
!   extern "C" const void* memchr(const void*, int, size_t); 
! 
!   inline void*
!   memchr(void* __p, int __c, size_t __n)
!   {
!     return const_cast<void*>(memchr(const_cast<const void*>(__p), __c, __n));
!   }
! 
!   inline const char*
!   strchr(const char* __s1, int __n)
!   { return const_cast<const char*>(__builtin_strchr(__s1, __n)); }
! 
!   inline char*
!   strchr(char* __s1, int __n)
!   {
!     return 
!       const_cast<char*>(__builtin_strchr(const_cast<const char*>(__s1), __n));
!   }
! 
!   inline size_t
!   strcspn(const char* __s1, const char* __s2)
!   { return __builtin_strcspn(__s1, __s2); }
! 
!   inline const char*
!   strpbrk(const char* __s1, const char* __s2)
!   { return const_cast<char*>(__builtin_strpbrk(__s1, __s2)); }
! 
!   inline char*
!   strpbrk(char* __s1, const char* __s2)
!   {
!     return const_cast<char*>
!       (__builtin_strpbrk(const_cast<const char*>(__s1), __s2));
!   }
! 
!   inline const char*
!   strrchr(const char* __s1, int __n)
!   { return const_cast<char*>(__builtin_strrchr(__s1, __n)); }
! 
!   inline char*
!   strrchr(char* __s1, int __n)
!   { return __builtin_strrchr(const_cast<const char*>(__s1), __n); }
! 
!   inline size_t
!   strspn(const char* __s1, const char* __s2)
!   { return __builtin_strspn(__s1, __s2); }
! 
!   inline const char*
!   strstr(const char* __s1, const char* __s2)
!   { return const_cast<char*>(__builtin_strstr (__s1, __s2)); }
! 
!   inline char*
!   strstr(char* __s1, const char* __s2)
!   {
!     return (const_cast<char*>
! 	    (__builtin_strstr(const_cast<const char*>(__s1), __s2)));
!   }
! 
!   extern "C" char* strtok(char*, const char*); 
! 
!   inline void*
!   memset(void* __p, int __c, size_t __n)
!   { return __builtin_memset(__p, __c, __n); }
! 
!   extern "C" char* strerror(int); 
! 
!   inline size_t
!   strlen(const char* __s)
!   { return __builtin_strlen(__s); }
  }
  
  #endif
--- 28,177 ----
  // the GNU General Public License.
  
  //
! // ISO/IEC C++ 14882:1998 21.4 Null terminated sequence utilities [lib.c.strings]
  //
  
  #ifndef _CPP_CSTRING
  #define _CPP_CSTRING 1
  
  #pragma GCC system_header
! 
! #include <bits/c++config.h>
! #include <bits/std_cstddef.h>	// for std::size_t and NULL
  
! // Get rid of potentially defined hiding macros.
! #undef memchr
! #undef memcmp
  #undef memcpy
  #undef memmove
! #undef memset
  #undef strcat
! #undef strchr
  #undef strcmp
  #undef strcoll
! #undef strcpy
  #undef strcspn
+ #undef strerror
+ #undef strlen
+ #undef strncat
+ #undef strncmp
+ #undef strncpy
  #undef strpbrk
  #undef strrchr
  #undef strspn
  #undef strstr
  #undef strtok
! #undef strxfrm
  
  namespace std 
  {
!   /** Scan readonly memory for a character. */
!   extern const void*
!   memchr(const void*, int, size_t); 
! 
!   /** Scan memory for a character. */
!   extern void*
!   memchr(void*, int, size_t);
! 
!   /** Compare memory regions. */
!   extern int
!   memcmp(const void*, const void*, size_t);
! 
!   /** Copy a memory region. */
!   extern void*
!   memcpy(void*, const void*, size_t);
! 
!   /** Copy a memory region with possible overlaps.  */
!   extern void*
!   memmove(void*, const void*, size_t); 
! 
!   /** Fill a memory region with a specific byte value. */
!   extern void*
!   memset(void*, int, size_t);
! 
!   /** Concatenate an NTCTS string to another. */
!   extern char*
!   strcat(char*, const char*);
! 
!   /** Locate a character in a readonly NTCTS string. */
!   extern const char*
!   strchr(const char*, int __n);
! 
!   /** Locate a character in an NTCTS string. */
!   extern char*
!   strchr(char*, int __n);
! 
!   /** Compare two NTCTS strings for bytewise equality. */
!   extern int
!   strcmp(const char*, const char*);
! 
!   /** Compare two NTCTS strings for lexicographic equality. */
!   extern int
!   strcoll(const char*, const char*); 
! 
!   /** Copy one NTCTS string to another. */
!   extern char*
!   strcpy(char*, const char*);
! 
!   /** Find the span of characters not in an NTCTS string. */
!   extern size_t
!   strcspn(const char*, const char*);
! 
!   /** Get a system error string given an errno. */
!   extern char*
!   strerror(int); 
! 
!   /** Get the length of an NTCTS string. */
!   extern size_t
!   strlen(const char*);
! 
!   /** Concatenate up to N bytes of an NTCTS to another. */
!   extern char*
!   strncat(char*, const char*, size_t);
! 
!   /** Bytewise compare up to N bytes of two NTCTS strings. */
!   extern int
!   strncmp(const char*, const char*, size_t);
! 
!   /** Copy up to N bytes of an NTCTS string to another. */
!   extern char*
!   strncpy(char*, const char*, size_t);
! 
!   /** Search a readonly NTCTS string for any of a set of characters. */
!   extern const char*
!   strpbrk(const char*, const char*);
! 
!   /** Search an NTCTS string for any of a set of characters. */
!   extern char*
!   strpbrk(char*, const char*);
! 
!   /** Reverse search a readonly NTCTS for a specific character. */
!   extern const char*
!   strrchr(const char*, int);
! 
!   /** Reverse search an NTCTS for a specific character. */
!   extern char*
!   strrchr(char*, int);
! 
!   /** Find the span of characters in an NTCTS string. */
!   extern size_t
!   strspn(const char*, const char*);
! 
!   /** Search for a substring in a readonly NTCTS. */
!   extern const char*
!   strstr(const char*, const char*);
! 
!   /** Search for a substring in an NTCTS. */
!   extern char*
!   strstr(char*, const char*);
! 
!   /** Break an NTCTS into delimited tokens. */
!   extern char*
!   strtok(char*, const char*); 
! 
!   /** Hash an NTMB string into an NTSC string using LC_COLLATE rules. */
!   extern size_t
!   strxfrm(char*, const char*, size_t); 
  }
  
  #endif
Index: libstdc++-v3/src/Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/Makefile.am,v
retrieving revision 1.86
diff -c -3 -p -r1.86 Makefile.am
*** Makefile.am	2001/06/01 09:22:05	1.86
--- Makefile.am	2001/06/06 02:20:27
*************** c_base_headers = \
*** 126,131 ****
--- 126,134 ----
  	bits/std_cstdlib.h bits/std_cstring.h bits/std_ctime.h \
  	bits/std_cwchar.h bits/std_cwctype.h bits/cmath.tcc
  
+ c_libc_headers = \
+ 	bits/string.h
+ 
  if GLIBCPP_USE_CSHADOW
  c_shadow_headers = \
  	assert.h ctype.h errno.h float.h limits.h locale.h math.h setjmp.h \
*************** sources = \
*** 170,176 ****
  	basic_file.cc ios.cc complex_io.cc strstream.cc \
  	c++locale.cc locale.cc localename.cc codecvt.cc \
  	locale-inst.cc stl-inst.cc misc-inst.cc valarray-inst.cc \
! 	string-inst.cc wstring-inst.cc 
  
  
  VPATH = $(top_srcdir):$(top_srcdir)/src:$(GLIBCPP_INCLUDE_DIR):$(GLIBCPP_INCLUDE_DIR)/std:$(C_INCLUDE_DIR)
--- 173,180 ----
  	basic_file.cc ios.cc complex_io.cc strstream.cc \
  	c++locale.cc locale.cc localename.cc codecvt.cc \
  	locale-inst.cc stl-inst.cc misc-inst.cc valarray-inst.cc \
! 	string-inst.cc wstring-inst.cc \
! 	cstring.cc
  
  
  VPATH = $(top_srcdir):$(top_srcdir)/src:$(GLIBCPP_INCLUDE_DIR):$(GLIBCPP_INCLUDE_DIR)/std:$(C_INCLUDE_DIR)
*************** myinstallheaders: 
*** 262,267 ****
--- 266,275 ----
  	for i in $(c_base_headers); do \
  	echo "$(INSTALL_DATA) $(c_incdir)/$$i $(gxx_include_dir)/bits/";\
  	  $(INSTALL_DATA) $(c_incdir)/$$i $(gxx_include_dir)/bits/; \
+ 	done; \
+ 	for i in $(c_libc_headers); do \
+ 	echo "$(INSTALL_DATA) $(c_incdir)/$$i $(gxx_include_dir)";\
+ 	  $(INSTALL_DATA) $(c_incdir)/$$i $(gxx_include_dir); \
  	done; \
  	for i in $(std_headers); do \
  	echo "$(INSTALL_DATA) $(src_incdir)/std/$$i $(gxx_include_dir)";\
// -*- C++ -*- STRING.H

// Copyright (C) 2001 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
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING.  If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.

// As a special exception, you may use this file as part of a free software
// library without restriction.  Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License.  This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.

//
// ISO/IEC C++ 14882:1998 D.5 Standard C library headers [depr.c.headers]
//

#ifndef _CPP_STRING_H
#define _CPP_STRING_H 1

#pragma GCC system_header

// Need to mangle these "C" functions because they are redefined in C++
#define memchr __glibcpp_memchr
#define memcmp __glibcpp_memcmp
#define memcpy __glibcpp_memcpy
#define memmove __glibcpp_memmove
#define memset __glibcpp_memset
#define strcat __glibcpp_strcat
#define strchr __glibcpp_strchr
#define strcmp __glibcpp_strcmp
#define strcoll __glibcpp_strcoll
#define strcpy __glibcpp_strcpy
#define strcspn __glibcpp_strcspn
#define strerror __glibcpp_strerror
#define strlen __glibcpp_strlen
#define strncat __glibcpp_strncat
#define strncmp __glibcpp_strncmp
#define strncpy __glibcpp_strncpy
#define strpbrk __glibcpp_strpbrk
#define strrchr __glibcpp_strrchr
#define strspn __glibcpp_strspn
#define strstr __glibcpp_strstr
#define strtok __glibcpp_strtok
#define strxfrm __glibcpp_strxfrm

// bring in any nonstandard C declarations
#include_next <string.h>

// Get rid of any macros defined in <string.h> in lieu of real functions.
#undef memchr
#undef memcmp
#undef memcpy
#undef memmove
#undef memset
#undef strcat
#undef strchr
#undef strcmp
#undef strcoll
#undef strcpy
#undef strcspn
#undef strerror
#undef strlen
#undef strncat
#undef strncmp
#undef strncpy
#undef strpbrk
#undef strrchr
#undef strspn
#undef strstr
#undef strtok
#undef strxfrm

// bring in the C++ declarations
#include <bits/std_cstring.h>

// inject the standard C++ names into the global namespace
using ::std::memchr;
using ::std::memcmp;
using ::std::memcpy;
using ::std::memmove; 
using ::std::memset;
using ::std::strcat;
using ::std::strchr;
using ::std::strcmp;
using ::std::strcoll; 
using ::std::strcpy;
using ::std::strcspn;
using ::std::strerror; 
using ::std::strlen;
using ::std::strncat;
using ::std::strncmp;
using ::std::strncpy;
using ::std::strpbrk;
using ::std::strrchr;
using ::std::strspn;
using ::std::strstr;
using ::std::strtok; 
using ::std::strxfrm; 

#endif /* _CPP_STRING_H */

// Copyright (C) 2001 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
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING.  If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.

// As a special exception, you may use this file as part of a free software
// library without restriction.  Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License.  This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.

//
// ISO/IEC 14882:1998 21.4 Null terminated sequence utilities [lib.c.strings]
//

// bring 'em on.
#undef __NO_STRING_INLINES

#include <bits/std_cstddef.h>	// for std::size_t
#include <string.h>     		// C library string functions

namespace {
    inline void*
    _libc_memchr(const void* __p, int __c, size_t __n)
    { return memchr(__p, __c, __n); }

    inline int
    _libc_memcmp(const void* __p1, const void* __p2, size_t __n)
#ifdef _HAVE___BUILTIN_MEMCMP
    { return __builtin_memcmp(__p1, __p2, __n); }
#else
    { return memcmp(__p1, __p2, __n); }
#endif

    inline void*
    _libc_memcpy(void* __p1, const void* __p2, size_t __n)
#ifdef _HAVE___BUILTIN_MEMCPY
    { return __builtin_memcpy(__p1, __p2, __n); }
#else
    { return memcpy(__p1, __p2, __n); }
#endif

    inline void*
    _libc_memmove(void* __p1, const void* __p2, size_t __n)
    { return memmove(__p1, __p2, __n); }

    inline void*
    _libc_memset(void* __p, int __c , size_t __n)
#ifdef _HAVE___BUILTIN_MEMSET
    { return __builtin_memset(__p, __c, __n); }
#else
    { return memset(__p, __c, __n); }
#endif

    inline char*
    _libc_strcat(char* __s1, const char* __s2)
#ifdef _HAVE___BUILTIN_STRCAT
    { return __builtin_strcat(__s1, __s2); }
#else
    { return strcat(__s1, __s2); }
#endif

    inline char*
    _libc_strchr(const char* __s1, int __c)
#ifdef _HAVE___BUILTIN_STRCHR
    { return __builtin_strchr(__s1, __c); }
#else
    { return strchr(__s1, __c); }
#endif

    inline int
    _libc_strcmp(const char* __s1, const char* __s2)
#ifdef _HAVE___BUILTIN_STRCMP
    { return __builtin_strcmp(__s1, __s2); }
#else
    { return strcmp(__s1, __s2); }
#endif

    inline int
    _libc_strcoll(const char* __s1, const char* __s2)
    { return strcoll(__s1, __s2); }

    inline char*
    _libc_strcpy(char* __s1, const char* __s2)
#ifdef _HAVE___BUILTIN_STRCPY
    { return __builtin_strcpy(__s1, __s2); }
#else
    { return strcpy(__s1, __s2); }
#endif

    inline size_t
    _libc_strcspn(const char* __s1, const char* __s2)
#ifdef _HAVE___BUILTIN_STRCSPN
    { return __builtin_strcspn(__s1, __s2); }
#else
    { return strcspn(__s1, __s2); }
#endif

    inline char*
    _libc_strerror(int __e)
    { return strerror(__e); }

    inline size_t
    _libc_strlen(const char* __s)
#ifdef _HAVE___BUILTIN_STRLEN
    { return __builtin_strlen(__s); }
#else
    { return strlen(__s); }
#endif

    inline char*
    _libc_strncat(char* __s1, const char* __s2, size_t __n)
#ifdef _HAVE___BUILTIN_STRNCAT
    { return __builtin_strncat(__s1, __s2, __n); }
#else
    { return strncat(__s1, __s2, __n); }
#endif

    inline int
    _libc_strncmp(const char* __s1, const char* __s2, size_t __n)
#ifdef _HAVE___BUILTIN_STRNCMP
    { return __builtin_strncmp(__s1, __s2); }
#else
    { return strncmp(__s1, __s2, __n); }
#endif

    inline char*
    _libc_strncpy(char* __s1, const char* __s2, size_t __n)
#ifdef _HAVE___BUILTIN_STRNCPY
    { return __builtin_strncpy(__s1, __s2); }
#else
    { return strncpy(__s1, __s2, __n); }
#endif

    inline char*
    _libc_strpbrk(const char* __s1, const char* __s2)
    { return strpbrk(__s1, __s2); }

    inline char*
    _libc_strrchr(const char* __s1, int __c)
#ifdef _HAVE___BUILTIN_STRRCHR
    { return __builtin_strrchr(__s1, __c); }
#else
    { return strrchr(__s1, __c); }
#endif

    inline size_t
    _libc_strspn(const char* __s1, const char* __s2)
#ifdef _HAVE___BUILTIN_STRSPN
    { return __builtin_strspn(__s1, __s2); }
#else
    { return strspn(__s1, __s2); }
#endif

    inline char*
    _libc_strstr(const char* __s1, const char* __s2)
#ifdef _HAVE___BUILTIN_STRSTR
    { return __builtin_strstr(__s1, __s2); }
#else
    { return strstr(__s1, __s2); }
#endif

    inline char*
    _libc_strtok(char* __s1, const char* __s2)
    { return strtok(__s1, __s2); }

    inline size_t
    _libc_strxfrm(char* __s1, const char* __s2, size_t __n)
    { return strxfrm(__s1, __s2, __n); }
}

// Undefine any ptentially hiding macros.
#undef memchr
#undef memcmp
#undef memcpy
#undef memmove
#undef memset
#undef strcat
#undef strchr
#undef strcmp
#undef strcoll
#undef strcpy
#undef strcspn
#undef strerror
#undef strlen
#undef strncat
#undef strncmp
#undef strncpy
#undef strpbrk
#undef strrchr
#undef strspn
#undef strstr
#undef strtok
#undef strxfrm

namespace std
{
    const void*
    memchr(const void* __p, int __c, size_t __n)
    { return _libc_memchr(__p, __c, __n); }

    void*
    memchr(void* __p, int __c, size_t __n)
    { return _libc_memchr(__p, __c, __n); }

    int
    memcmp(const void* __p1, const void* __p2, size_t __n)
    { return _libc_memcmp(__p1, __p2, __n); } 

    void*
    memcpy(void* __p1, const void* __p2, size_t __n)
    { return _libc_memcpy(__p1, __p2, __n); }

    void*
    memmove(void* __p1, const void* __p2, size_t __n)
    { return _libc_memmove(__p1, __p2, __n); }

    char* strcpy(char* __s1, const char* __s2)
    { return _libc_strcpy(__s1, __s2); }

    char* strncpy(char* __s1, const char* __s2, size_t __n)
    { return _libc_strncpy(__s1, __s2, __n); }

    char* strcat(char* __s1, const char* __s2)
    { return _libc_strcat(__s1, __s2); }

    char* strncat(char* __s1, const char* __s2, size_t __n)
    { return _libc_strncat(__s1, __s2, __n); }

    const char*
    strchr(const char* __s1, int __c)
    { return _libc_strchr(__s1, __c); }

    int
    strcmp(const char* __s1, const char* __s2)
    { return _libc_strcmp(__s1, __s2); }

    int
    strncmp(const char* __s1, const char* __s2, size_t __n)
    { return _libc_strncmp(__s1, __s2, __n); }

    int
    strcoll(const char* __s1, const char* __s2)
    { return _libc_strcoll(__s1, __s2); }

    char*
    strchr(char* __s1, int __c)
    { return _libc_strchr(__s1, __c); }

    size_t
    strxfrm(char* __s1, const char* __s2, size_t __n)
    { return _libc_strxfrm(__s1, __s2, __n); }

    size_t
    strcspn(const char* __s1, const char* __s2)
    { return _libc_strcspn(__s1, __s2); }

    const char*
    strpbrk(const char* __s1, const char* __s2)
    { return _libc_strpbrk(__s1, __s2); }

    char*
    strpbrk(char* __s1, const char* __s2)
    { return _libc_strpbrk(__s1, __s2); }

    const char*
    strrchr(const char* __s1, int __c)
    { return _libc_strrchr( __s1, __c); }

    char*
    strrchr(char* __s1, int __c)
    { return _libc_strrchr( __s1, __c); }

    size_t
    strspn(const char* __s1, const char* __s2)
    { return _libc_strspn(__s1, __s2); }

    const char*
    strstr(const char* __s1, const char* __s2)
    { return _libc_strstr(__s1, __s2); }

    char*
    strstr(char* __s1, const char* __s2)
    { return _libc_strstr(__s1, __s2); }

    char*
    strtok(char* __s1, const char* __s2)
    { return _libc_strtok(__s1, __s2); }

    void*
    memset(void* __p, int __c, size_t __n)
    { return _libc_memset(__p, __c, __n); }

    char*
    strerror(int __e)
    { return _libc_strerror(__e); }

    size_t
    strlen(const char* __s)
    { return _libc_strlen(__s); }
}

#include <cstring>
#include <string.h>

using namespace std;

int
main(int argc, char* argv[])
{
  char foo[300];
  char* bar = "foo";

  strcpy(foo, bar);
  return 0;
}


#include <string.h>
#include <cstring>

using namespace std;

int
main(int argc, char* argv[])
{
  char* ntcts = "all star welding";

  size_t kk = strlen(ntcts);
  return 0;
}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]