From: Scott Snyder Date: Tue, 6 Mar 2001 02:51:15 +0000 (+0000) Subject: std_cmath.h: Move abs(long), div(long,long) from here... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=21aaf8bffcf05aec09db0213f8210cc205175141;p=gcc.git std_cmath.h: Move abs(long), div(long,long) from here... 2001-03-05 scott snyder 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 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 8de536088db..4007fcfc48b 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2001-03-05 scott snyder + + 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 * libsupc++/vec.cc (__cxxa_vec_new2): Qualify size_t. diff --git a/libstdc++-v3/include/c_std/bits/std_cmath.h b/libstdc++-v3/include/c_std/bits/std_cmath.h index 3648b20a5c6..acddb33f28e 100644 --- a/libstdc++-v3/include/c_std/bits/std_cmath.h +++ b/libstdc++-v3/include/c_std/bits/std_cmath.h @@ -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); } diff --git a/libstdc++-v3/include/c_std/bits/std_cstdlib.h b/libstdc++-v3/include/c_std/bits/std_cstdlib.h index 5ee0b7e9b6e..8b7776db3ba 100644 --- a/libstdc++-v3/include/c_std/bits/std_cstdlib.h +++ b/libstdc++-v3/include/c_std/bits/std_cstdlib.h @@ -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; } diff --git a/libstdc++-v3/testsuite/17_intro/header_cstdlib.cc b/libstdc++-v3/testsuite/17_intro/header_cstdlib.cc index 3a4664e6779..5ce60cb05f3 100644 --- a/libstdc++-v3/testsuite/17_intro/header_cstdlib.cc +++ b/libstdc++-v3/testsuite/17_intro/header_cstdlib.cc @@ -22,14 +22,25 @@ #include +// 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 } - return 0; } +int main() +{ + test01(); + test02(); + return 0; +}