You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by se...@apache.org on 2008/02/11 22:30:42 UTC

svn commit: r620615 - /stdcxx/trunk/include/rw/_traits.h

Author: sebor
Date: Mon Feb 11 13:30:42 2008
New Revision: 620615

URL: http://svn.apache.org/viewvc?rev=620615&view=rev
Log:
2008-02-11  Martin Sebor  <se...@roguewave.com>

	STDCXX-687
	* include/rw/_traits.h [__GNUG__](_RWSTD_MEMCPY, _RWSTD_MEMCMP,
	_RWSTD_MEMMOVE,	_RWSTD_MEMSET, _RWSTD_STRLEN): #defined macros
	to the corresponding gcc __builtins.
	[4 < __GNUG__ || 3 <= __GNUC_MINOR__](_RWSTD_MEMCHR): #defined
	to __builtin_memchr starting with this version of the compiler.

Modified:
    stdcxx/trunk/include/rw/_traits.h

Modified: stdcxx/trunk/include/rw/_traits.h
URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/rw/_traits.h?rev=620615&r1=620614&r2=620615&view=diff
==============================================================================
--- stdcxx/trunk/include/rw/_traits.h (original)
+++ stdcxx/trunk/include/rw/_traits.h Mon Feb 11 13:30:42 2008
@@ -25,7 +25,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -84,15 +84,33 @@
 #  define _RWSTD_WMEMSET   _RW::__rw_wmemset
 #  define _RWSTD_WCSLEN    _RW::__rw_wcslen
 #else   // if !defined (_RWSTDDEBUG) && !defined (_RWSTD_EDG_ECCP)
-#  include _RWSTD_CSTRING   // for memcmp(), ...
-#  include _RWSTD_CWCHAR    // wmemcmp(), ...
 
-#  define _RWSTD_MEMCPY    _RWSTD_C::memcpy
-#  define _RWSTD_MEMCMP    _RWSTD_C::memcmp
-#  define _RWSTD_MEMMOVE   _RWSTD_C::memmove
-#  define _RWSTD_MEMSET    _RWSTD_C::memset
-#  define _RWSTD_STRLEN    _RWSTD_C::strlen
-#  define _RWSTD_MEMCHR    _RWSTD_C::memchr
+#  if 4 <= __GNUG__
+     // use gcc 4.x intrinsic functions
+#    define _RWSTD_MEMCPY    __builtin_memcpy
+#    define _RWSTD_MEMCMP    __builtin_memcmp
+#    define _RWSTD_MEMMOVE   __builtin_memmove
+#    define _RWSTD_MEMSET    __builtin_memset
+#    define _RWSTD_STRLEN    __builtin_strlen
+
+#    if 4 < __GNUG__ || 3 <= __GNUC_MINOR__
+       // __builtin_memchr() is only available in gcc 4.3 and beyond
+#      define _RWSTD_MEMCHR    __builtin_memchr
+#    else   // gcc < 4.3
+#      include _RWSTD_CSTRING   // for memchr()
+#    endif   // gcc 4.3
+#  else   // gcc < 4.0
+#    include _RWSTD_CSTRING   // for memcmp(), ...
+
+#    define _RWSTD_MEMCPY    _RWSTD_C::memcpy
+#    define _RWSTD_MEMCMP    _RWSTD_C::memcmp
+#    define _RWSTD_MEMMOVE   _RWSTD_C::memmove
+#    define _RWSTD_MEMSET    _RWSTD_C::memset
+#    define _RWSTD_STRLEN    _RWSTD_C::strlen
+#    define _RWSTD_MEMCHR    _RWSTD_C::memchr
+#  endif   // gcc 4.0
+
+#  include _RWSTD_CWCHAR    // wmemcmp(), ...
 
 #  ifndef _RWSTD_NO_WMEMCPY
 #    define _RWSTD_WMEMCPY   _RWSTD_C::wmemcpy