From 360721e336dbcceb4254ffbc6fd06b655ef3a9ec Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Mon, 7 May 2007 20:36:40 +0000 Subject: [PATCH] stl_algobase.h: Do not include . 2007-05-07 Paolo Carlini * include/bits/stl_algobase.h: Do not include . (copy(const _Tp*, const _Tp*, _Tp*), __copy_b(const _Tp*, const _Tp*, _Tp*)): Use __builtin_memmove. (__fill_aux): Use __builtin_memset. (equal(const _Tp*, const _Tp*, const _Tp*), lexicographical_compare(const unsigned char*, const unsigned char*, const unsigned char*, const unsigned char*)): Use __builtin_memcmp. * include/bits/valarray_array.h: Do not include . (_Array_default_ctor<, true>::_S_do_it): Use __builtin_memset. (_Array_copy_ctor<, true>::_S_do_it, _Array_copier<, true>::_S_do_it): Use __builtin_memcpy. * include/ext/algorithm (__lexicographical_compare_3way(const unsigned char*, const unsigned char*, const unsigned char*, const unsigned char*)): Use __builtin_memcmp. * testsuite/23_containers/vector/requirements/dr438/ constructor_1_neg.cc: Adjust dg-error line number. * testsuite/23_containers/vector/requirements/dr438/ constructor_2_neg.cc: Likewise. From-SVN: r124511 --- libstdc++-v3/ChangeLog | 22 +++++++++++++++++++ libstdc++-v3/include/bits/stl_algobase.h | 22 ++++++++++--------- libstdc++-v3/include/ext/algorithm | 6 +++-- .../requirements/dr438/constructor_1_neg.cc | 2 +- .../requirements/dr438/constructor_2_neg.cc | 2 +- 5 files changed, 40 insertions(+), 14 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index b08c8a7a6e9..57c7c83744d 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,25 @@ +2007-05-07 Paolo Carlini + + * include/bits/stl_algobase.h: Do not include . + (copy(const _Tp*, const _Tp*, _Tp*), __copy_b(const _Tp*, const _Tp*, + _Tp*)): Use __builtin_memmove. + (__fill_aux): Use __builtin_memset. + (equal(const _Tp*, const _Tp*, const _Tp*), + lexicographical_compare(const unsigned char*, const unsigned char*, + const unsigned char*, const unsigned char*)): Use __builtin_memcmp. + * include/bits/valarray_array.h: Do not include . + (_Array_default_ctor<, true>::_S_do_it): Use __builtin_memset. + (_Array_copy_ctor<, true>::_S_do_it, _Array_copier<, true>::_S_do_it): + Use __builtin_memcpy. + * include/ext/algorithm + (__lexicographical_compare_3way(const unsigned char*, + const unsigned char*, const unsigned char*, const unsigned char*)): + Use __builtin_memcmp. + * testsuite/23_containers/vector/requirements/dr438/ + constructor_1_neg.cc: Adjust dg-error line number. + * testsuite/23_containers/vector/requirements/dr438/ + constructor_2_neg.cc: Likewise. + 2007-05-07 Mark Mitchell * testsuite/22_locale/num_put/put/char/14220.cc: XFAIL on Solaris diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h index 6be1eb123e1..caf219d1fbb 100644 --- a/libstdc++-v3/include/bits/stl_algobase.h +++ b/libstdc++-v3/include/bits/stl_algobase.h @@ -63,7 +63,6 @@ #define _ALGOBASE_H 1 #include -#include #include #include #include @@ -348,7 +347,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) static _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) { - std::memmove(__result, __first, sizeof(_Tp) * (__last - __first)); + __builtin_memmove(__result, __first, + sizeof(_Tp) * (__last - __first)); return __result + (__last - __first); } }; @@ -464,7 +464,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) __copy_b(const _Tp* __first, const _Tp* __last, _Tp* __result) { const ptrdiff_t _Num = __last - __first; - std::memmove(__result - _Num, __first, sizeof(_Tp) * _Num); + __builtin_memmove(__result - _Num, __first, sizeof(_Tp) * _Num); return __result - _Num; } }; @@ -560,15 +560,17 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // Specialization: for char types we can use memset. inline void __fill_aux(unsigned char* __first, unsigned char* __last, unsigned char __c) - { std::memset(__first, __c, __last - __first); } + { __builtin_memset(__first, __c, __last - __first); } inline void __fill_aux(signed char* __first, signed char* __last, signed char __c) - { std::memset(__first, static_cast(__c), __last - __first); } + { __builtin_memset(__first, static_cast(__c), + __last - __first); } inline void __fill_aux(char* __first, char* __last, char __c) - { std::memset(__first, static_cast(__c), __last - __first); } + { __builtin_memset(__first, static_cast(__c), + __last - __first); } /** * @brief Fills the range [first,last) with copies of value. @@ -764,8 +766,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) static bool equal(const _Tp* __first1, const _Tp* __last1, const _Tp* __first2) { - return !std::memcmp(__first1, __first2, sizeof(_Tp) - * (__last1 - __first1)); + return !__builtin_memcmp(__first1, __first2, sizeof(_Tp) + * (__last1 - __first1)); } }; @@ -931,8 +933,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) const size_t __len1 = __last1 - __first1; const size_t __len2 = __last2 - __first2; - const int __result = std::memcmp(__first1, __first2, - std::min(__len1, __len2)); + const int __result = __builtin_memcmp(__first1, __first2, + std::min(__len1, __len2)); return __result != 0 ? __result < 0 : __len1 < __len2; } diff --git a/libstdc++-v3/include/ext/algorithm b/libstdc++-v3/include/ext/algorithm index 712a4edc7fd..10ca58aa2fd 100644 --- a/libstdc++-v3/include/ext/algorithm +++ b/libstdc++-v3/include/ext/algorithm @@ -1,6 +1,7 @@ // Algorithm extensions -*- C++ -*- -// Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 +// 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 @@ -161,7 +162,8 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) { const ptrdiff_t __len1 = __last1 - __first1; const ptrdiff_t __len2 = __last2 - __first2; - const int __result = std::memcmp(__first1, __first2, min(__len1, __len2)); + const int __result = __builtin_memcmp(__first1, __first2, + min(__len1, __len2)); return __result != 0 ? __result : (__len1 == __len2 ? 0 : (__len1 < __len2 ? -1 : 1)); } diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc index b850c71cf84..79e339d3841 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no match" "" { target *-*-* } 620 } +// { dg-error "no match" "" { target *-*-* } 622 } // { dg-excess-errors "" } #include diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc index 194da7342a4..bcc4f4755cc 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no match" "" { target *-*-* } 620 } +// { dg-error "no match" "" { target *-*-* } 622 } // { dg-excess-errors "" } #include -- 2.30.2