Commit 360721e3 by Paolo Carlini Committed by Paolo Carlini

stl_algobase.h: Do not include <cstring>.

2007-05-07  Paolo Carlini  <pcarlini@suse.de>

	* include/bits/stl_algobase.h: Do not include <cstring>.
	(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 <cstring>.
	(_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
parent 25a5e756
2007-05-07 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_algobase.h: Do not include <cstring>.
(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 <cstring>.
(_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 <mark@codesourcery.com>
* testsuite/22_locale/num_put/put/char/14220.cc: XFAIL on Solaris
......
......@@ -63,7 +63,6 @@
#define _ALGOBASE_H 1
#include <bits/c++config.h>
#include <cstring>
#include <cstddef>
#include <bits/functexcept.h>
#include <bits/stl_pair.h>
......@@ -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<unsigned char>(__c), __last - __first); }
{ __builtin_memset(__first, static_cast<unsigned char>(__c),
__last - __first); }
inline void
__fill_aux(char* __first, char* __last, char __c)
{ std::memset(__first, static_cast<unsigned char>(__c), __last - __first); }
{ __builtin_memset(__first, static_cast<unsigned char>(__c),
__last - __first); }
/**
* @brief Fills the range [first,last) with copies of value.
......@@ -764,7 +766,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
static bool
equal(const _Tp* __first1, const _Tp* __last1, const _Tp* __first2)
{
return !std::memcmp(__first1, __first2, sizeof(_Tp)
return !__builtin_memcmp(__first1, __first2, sizeof(_Tp)
* (__last1 - __first1));
}
};
......@@ -931,7 +933,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
const size_t __len1 = __last1 - __first1;
const size_t __len2 = __last2 - __first2;
const int __result = std::memcmp(__first1, __first2,
const int __result = __builtin_memcmp(__first1, __first2,
std::min(__len1, __len2));
return __result != 0 ? __result < 0 : __len1 < __len2;
}
......
// 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));
}
......
......@@ -19,7 +19,7 @@
// USA.
// { dg-do compile }
// { dg-error "no match" "" { target *-*-* } 620 }
// { dg-error "no match" "" { target *-*-* } 622 }
// { dg-excess-errors "" }
#include <vector>
......
......@@ -19,7 +19,7 @@
// USA.
// { dg-do compile }
// { dg-error "no match" "" { target *-*-* } 620 }
// { dg-error "no match" "" { target *-*-* } 622 }
// { dg-excess-errors "" }
#include <vector>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment