re PR libstdc++/13943 (call of overloaded `llabs(int)' is ambiguous)
2005-05-26 Paolo Carlini <pcarlini@suse.de> PR libstdc++/13943 * include/c_std/std_cstdlib.h: Do not open code llabs and lldiv, available when _GLIBCXX_USE_C99 is defined. * testsuite/26_numerics/cstdlib/13943.cc: New. * acinclude.m4 ([GLIBCXX_ENABLE_C99]): For completeness, check also strtoll and strtoull for ac_c99_stdlib. * configure: Regenerate. From-SVN: r100205
This commit is contained in:
parent
2fe96b0a83
commit
10d877a8ed
|
@ -1,3 +1,14 @@
|
||||||
|
2005-05-26 Paolo Carlini <pcarlini@suse.de>
|
||||||
|
|
||||||
|
PR libstdc++/13943
|
||||||
|
* include/c_std/std_cstdlib.h: Do not open code llabs and lldiv,
|
||||||
|
available when _GLIBCXX_USE_C99 is defined.
|
||||||
|
* testsuite/26_numerics/cstdlib/13943.cc: New.
|
||||||
|
|
||||||
|
* acinclude.m4 ([GLIBCXX_ENABLE_C99]): For completeness, check
|
||||||
|
also strtoll and strtoull for ac_c99_stdlib.
|
||||||
|
* configure: Regenerate.
|
||||||
|
|
||||||
2005-05-25 Benjamin Kosnik <bkoz@redhat.com>
|
2005-05-25 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
|
||||||
* config/linker-map.gnu: Add linkage support for no extern templates.
|
* config/linker-map.gnu: Add linkage support for no extern templates.
|
||||||
|
|
|
@ -879,12 +879,14 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [
|
||||||
AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>])
|
AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>])
|
||||||
AC_CACHE_VAL(ac_c99_stdlib, [
|
AC_CACHE_VAL(ac_c99_stdlib, [
|
||||||
AC_TRY_COMPILE([#include <stdlib.h>],
|
AC_TRY_COMPILE([#include <stdlib.h>],
|
||||||
[char* tmp;
|
[char* tmp;
|
||||||
strtof("gnu", &tmp);
|
strtof("gnu", &tmp);
|
||||||
strtold("gnu", &tmp);
|
strtold("gnu", &tmp);
|
||||||
llabs(10);
|
strtoll("gnu", &tmp, 10);
|
||||||
lldiv(10,1);
|
strtoull("gnu", &tmp, 10);
|
||||||
atoll("10");
|
llabs(10);
|
||||||
|
lldiv(10,1);
|
||||||
|
atoll("10");
|
||||||
_Exit(0);
|
_Exit(0);
|
||||||
lldiv_t mydivt;],[ac_c99_stdlib=yes], [ac_c99_stdlib=no])
|
lldiv_t mydivt;],[ac_c99_stdlib=yes], [ac_c99_stdlib=no])
|
||||||
])
|
])
|
||||||
|
|
|
@ -7059,7 +7059,9 @@ main ()
|
||||||
char* tmp;
|
char* tmp;
|
||||||
strtof("gnu", &tmp);
|
strtof("gnu", &tmp);
|
||||||
strtold("gnu", &tmp);
|
strtold("gnu", &tmp);
|
||||||
llabs(10);
|
strtoll("gnu", &tmp, 10);
|
||||||
|
strtoull("gnu", &tmp, 10);
|
||||||
|
llabs(10);
|
||||||
lldiv(10,1);
|
lldiv(10,1);
|
||||||
atoll("10");
|
atoll("10");
|
||||||
_Exit(0);
|
_Exit(0);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// -*- C++ -*- forwarding header.
|
// -*- C++ -*- forwarding header.
|
||||||
|
|
||||||
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005
|
||||||
// Free Software Foundation, Inc.
|
// Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
// This file is part of the GNU ISO C++ Library. This library is free
|
// This file is part of the GNU ISO C++ Library. This library is free
|
||||||
|
@ -168,17 +168,14 @@ namespace __gnu_cxx
|
||||||
inline long long
|
inline long long
|
||||||
abs(long long __x) { return __x >= 0 ? __x : -__x; }
|
abs(long long __x) { return __x >= 0 ? __x : -__x; }
|
||||||
|
|
||||||
inline long long
|
|
||||||
llabs(long long __x) { return __x >= 0 ? __x : -__x; }
|
|
||||||
|
|
||||||
#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
|
#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
|
||||||
|
using ::llabs;
|
||||||
|
|
||||||
inline lldiv_t
|
inline lldiv_t
|
||||||
div(long long __n, long long __d)
|
div(long long __n, long long __d)
|
||||||
{ lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
|
{ lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
|
||||||
|
|
||||||
inline lldiv_t
|
using ::lldiv;
|
||||||
lldiv(long long __n, long long __d)
|
|
||||||
{ lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
|
#if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
|
||||||
|
@ -204,8 +201,8 @@ namespace std
|
||||||
#endif
|
#endif
|
||||||
using __gnu_cxx::_Exit;
|
using __gnu_cxx::_Exit;
|
||||||
using __gnu_cxx::abs;
|
using __gnu_cxx::abs;
|
||||||
using __gnu_cxx::llabs;
|
|
||||||
#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
|
#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
|
||||||
|
using __gnu_cxx::llabs;
|
||||||
using __gnu_cxx::div;
|
using __gnu_cxx::div;
|
||||||
using __gnu_cxx::lldiv;
|
using __gnu_cxx::lldiv;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
// Copyright (C) 2005 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
|
||||||
|
// terms of the GNU General Public License as published by the
|
||||||
|
// Free Software Foundation; either version 2, or (at your option)
|
||||||
|
// any later version.
|
||||||
|
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU General Public License along
|
||||||
|
// with this library; see the file COPYING. If not, write to the Free
|
||||||
|
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
// USA.
|
||||||
|
|
||||||
|
// As a special exception, you may use this file as part of a free software
|
||||||
|
// library without restriction. Specifically, if other files instantiate
|
||||||
|
// templates or use macros or inline functions from this file, or you compile
|
||||||
|
// this file and link it with other files to produce an executable, this
|
||||||
|
// file does not by itself cause the resulting executable to be covered by
|
||||||
|
// the GNU General Public License. This exception does not however
|
||||||
|
// invalidate any other reasons why the executable file might be covered by
|
||||||
|
// the GNU General Public License.
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <testsuite_hooks.h>
|
||||||
|
|
||||||
|
#if _GLIBCXX_USE_C99
|
||||||
|
// libstdc++/13943
|
||||||
|
void test01()
|
||||||
|
{
|
||||||
|
using namespace std;
|
||||||
|
bool test __attribute__((unused)) = true;
|
||||||
|
|
||||||
|
VERIFY( llabs(-3) == 3 );
|
||||||
|
|
||||||
|
lldiv_t q = lldiv(6, 4);
|
||||||
|
VERIFY( q.quot == 1 );
|
||||||
|
VERIFY( q.rem == 2 );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
#if _GLIBCXX_USE_C99
|
||||||
|
test01();
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue