std_cmath.h: Move abs(long), div(long,long) from here...

2001-03-05  scott snyder  <snyder@fnal.gov>

	libstdc++/2190
        * include/c_std/bits/std_cmath.h: Move abs(long), div(long,long)
        from here...
        * include/c_std/bits/std_cstdlib.h: ... to here.
	* testsuite/17_intro/header_cstdlib.cc: Add test.

From-SVN: r40254
This commit is contained in:
Scott Snyder 2001-03-06 02:51:15 +00:00 committed by Benjamin Kosnik
parent f283dc4414
commit 21aaf8bffc
4 changed files with 27 additions and 8 deletions

View File

@ -1,3 +1,11 @@
2001-03-05 scott snyder <snyder@fnal.gov>
libstdc++/2190
* include/c_std/bits/std_cmath.h: Move abs(long), div(long,long)
from here...
* include/c_std/bits/std_cstdlib.h: ... to here.
* testsuite/17_intro/header_cstdlib.cc: Add test.
2001-03-05 Stephen M. Webb <stephen.webb@cybersafe.com>
* libsupc++/vec.cc (__cxxa_vec_new2): Qualify size_t.

View File

@ -80,12 +80,6 @@ namespace std
return __x < _Tp() ? -__x : __x;
}
inline long
abs(long __i) { return ::labs(__i); }
inline ldiv_t
div(long __i, long __j) { return ::ldiv(__i, __j); }
#if _GLIBCPP_HAVE___BUILTIN_FABSF
inline float
abs(float __x) { return __builtin_fabsf(__x); }

View File

@ -130,6 +130,12 @@ namespace std
extern "C" size_t mbstowcs(wchar_t*, const char*, size_t);
extern "C" size_t wcstombs(char*, const wchar_t*, size_t);
inline long
abs(long __i) { return ::labs(__i); }
inline ldiv_t
div(long __i, long __j) { return ::ldiv(__i, __j); }
#ifdef _GLIBCPP_USE_LONG_LONG
inline long long
abs(long long __x) { return __x >= 0 ? __x : -__x; }

View File

@ -22,14 +22,25 @@
#include <cstdlib>
// libstdc++/2190
void test01()
{
long a = std::abs(1L);
ldiv_t b = std::div(2L, 1L);
}
int main(void)
void test02()
{
// Make sure size_t is in namespace std
std::size_t i = 5; // { dg-do compile }
}
int main()
{
test01();
test02();
return 0;
}