Commit 21aaf8bf by Scott Snyder Committed by Benjamin Kosnik

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
parent f283dc44
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> 2001-03-05 Stephen M. Webb <stephen.webb@cybersafe.com>
* libsupc++/vec.cc (__cxxa_vec_new2): Qualify size_t. * libsupc++/vec.cc (__cxxa_vec_new2): Qualify size_t.
......
...@@ -80,12 +80,6 @@ namespace std ...@@ -80,12 +80,6 @@ namespace std
return __x < _Tp() ? -__x : __x; 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 #if _GLIBCPP_HAVE___BUILTIN_FABSF
inline float inline float
abs(float __x) { return __builtin_fabsf(__x); } abs(float __x) { return __builtin_fabsf(__x); }
......
...@@ -130,6 +130,12 @@ namespace std ...@@ -130,6 +130,12 @@ namespace std
extern "C" size_t mbstowcs(wchar_t*, const char*, size_t); extern "C" size_t mbstowcs(wchar_t*, const char*, size_t);
extern "C" size_t wcstombs(char*, const wchar_t*, 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 #ifdef _GLIBCPP_USE_LONG_LONG
inline long long inline long long
abs(long long __x) { return __x >= 0 ? __x : -__x; } abs(long long __x) { return __x >= 0 ? __x : -__x; }
......
...@@ -22,14 +22,25 @@ ...@@ -22,14 +22,25 @@
#include <cstdlib> #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 // Make sure size_t is in namespace std
std::size_t i = 5; // { dg-do compile } std::size_t i = 5; // { dg-do compile }
return 0;
} }
int main()
{
test01();
test02();
return 0;
}
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