Commit 991a40fc by Benjamin Kosnik Committed by Benjamin Kosnik

std_cmath.h: Tweaks.


2000-05-10  Benjamin Kosnik  <bkoz@redhat.com>

	* bits/std_cmath.h: Tweaks.
	* math/mathconf.h: Tweaks and fixes for HP-UX 11.
	(sqrtf): Define away iff !builtin and !in <math.h>.
	(sinf): Same.
	(cosf): Same.
	(fabsf): Same.
	At some point this directory should be converted to c++, the
	autoconf tests should be run by the c++ compiler (not c), and
	<cmath> should be used instead of math.h.
	Move declaration of nan() here.
	* math/complex-stub.h (cabsl): Remove nan() declaration.

	Finish up FreeBSD4.0 support.
	* config/bsd/ctype.cc: Scope out toupper, tolower calls.
	* config/generic/ctype.cc: And here.
	* testsuite/21_strings/char_traits.cc (test02): Guard with
	_GLIBCPP_USE_WCHAR_T.

	via Phil Edwards  <pme@sourceware.cygnus.com>
	* bits/std_cctype.h: Remove _GLIBCPP_USE_NAMESPACES.
	* acconfig.h: And here.
	* acinclude.m4: Same.
	* testsuite/27_io/istream.cc: And here.
	* testsuite/27_io/ostream.cc: And here.

From-SVN: r33835
parent 8e9bf55e
2000-05-10 Benjamin Kosnik <bkoz@redhat.com>
* bits/std_cmath.h: Tweaks.
* math/mathconf.h: Tweaks and fixes for HP-UX 11.
(sqrtf): Define away iff !builtin and !in <math.h>.
(sinf): Same.
(cosf): Same.
(fabsf): Same.
At some point this directory should be converted to c++, the
autoconf tests should be run by the c++ compiler (not c), and
<cmath> should be used instead of math.h.
Move declaration of nan() here.
* math/complex-stub.h (cabsl): Remove nan() declaration.
Finish up FreeBSD4.0 support.
* config/bsd/ctype.cc: Scope out toupper, tolower calls.
* config/generic/ctype.cc: And here.
* testsuite/21_strings/char_traits.cc (test02): Guard with
_GLIBCPP_USE_WCHAR_T.
via Phil Edwards <pme@sourceware.cygnus.com>
* bits/std_cctype.h: Remove _GLIBCPP_USE_NAMESPACES.
* acconfig.h: And here.
* acinclude.m4: Same.
* testsuite/27_io/istream.cc: And here.
* testsuite/27_io/ostream.cc: And here.
2000-05-09 Benjamin Kosnik <bkoz@gnu.org>
* acinclude.m4 (GLIBCPP_CHECK_CPU): Change powerpc bits to
......
// acconfig.h symbols and macros for libstdc++ v3 -*- C++ -*-
// If using the namespace std, you need this. Eventually this should
// not be an option. In the meantime, and as things like std_ctype.h
// need to be hacked out, give people the option. If this is set to 1,
// CXXFLAGS should include -fhonor-std. If this is undefined, CXXFLAGS
// should include -fno-honor-std.
#undef _GLIBCPP_USE_NAMESPACES
// Include support for 'long long' and 'unsigned long long'.
#undef _GLIBCPP_USE_LONG_LONG
......
......@@ -664,7 +664,7 @@ dnl Run through flags (either default or command-line) and set things.
if test -n "$enable_cxx_flags"; then
for f in $enable_cxx_flags; do
case "$f" in
-fhonor-std) AC_DEFINE(_GLIBCPP_USE_NAMESPACES) ;;
-fhonor-std) ;;
-*) ;;
*) # and we're trying to pass /what/ exactly?
AC_MSG_ERROR([compiler flags start with a -]) ;;
......@@ -680,7 +680,7 @@ dnl
dnl Check for certain special build configurations.
dnl
dnl GLIBCPP_ENABLE_NAMESPACES
dnl --enable-namespaces sets '-fhonor-std' and defines _GLIBCPP_USE_NAMESPACES
dnl --enable-namespaces sets '-fhonor-std' and
dnl --disable-namespaces sets '-fno-honor-std' (the macro should be
dnl undefined by default in whatever.h.in).
dnl + Eventually, this will go away.
......@@ -702,7 +702,6 @@ enable_namespaces=GLIBCPP_ENABLE_NAMESPACES_DEFAULT)dnl
dnl Option parsed, now set things appropriately
case "$enable_namespaces" in
yes) NAMESPACES='-fhonor-std'
AC_DEFINE(_GLIBCPP_USE_NAMESPACES)
;;
no) NAMESPACES='-fno-honor-std'
;;
......
......@@ -676,7 +676,7 @@ dnl Run through flags (either default or command-line) and set things.
if test -n "$enable_cxx_flags"; then
for f in $enable_cxx_flags; do
case "$f" in
-fhonor-std) AC_DEFINE(_GLIBCPP_USE_NAMESPACES) ;;
-fhonor-std) ;;
-*) ;;
*) # and we're trying to pass /what/ exactly?
AC_MSG_ERROR([compiler flags start with a -]) ;;
......@@ -692,7 +692,7 @@ dnl
dnl Check for certain special build configurations.
dnl
dnl GLIBCPP_ENABLE_NAMESPACES
dnl --enable-namespaces sets '-fhonor-std' and defines _GLIBCPP_USE_NAMESPACES
dnl --enable-namespaces sets '-fhonor-std' and
dnl --disable-namespaces sets '-fno-honor-std' (the macro should be
dnl undefined by default in whatever.h.in).
dnl + Eventually, this will go away.
......@@ -714,7 +714,6 @@ enable_namespaces=GLIBCPP_ENABLE_NAMESPACES_DEFAULT)dnl
dnl Option parsed, now set things appropriately
case "$enable_namespaces" in
yes) NAMESPACES='-fhonor-std'
AC_DEFINE(_GLIBCPP_USE_NAMESPACES)
;;
no) NAMESPACES='-fno-honor-std'
;;
......
// -*- C++ -*- forwarding header.
// Copyright (C) 1997-1999 Free Software Foundation, Inc.
// Copyright (C) 1997-1999, 2000 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
......@@ -56,7 +56,7 @@ namespace std
# undef toupper
inline int
toupper(int __c) { return _S_toupper_helper(__c); }
#elif _GLIBCPP_USE_NAMESPACES
#else
inline int
toupper(int __c) { return ::toupper(__c); }
#endif
......@@ -67,7 +67,7 @@ namespace std
# undef tolower
inline int
tolower(int __c) { return _S_tolower_helper(__c); }
#elif _GLIBCPP_USE_NAMESPACES
#else
inline int
tolower(int __c) { return ::tolower(__c); }
#endif
......@@ -78,7 +78,7 @@ namespace std
# undef isspace
inline int
isspace(int __c) { return _S_isspace_helper(__c); }
#elif _GLIBCPP_USE_NAMESPACES
#else
inline int
isspace(int __c) { return ::isspace(__c); }
#endif
......@@ -89,7 +89,7 @@ namespace std
# undef isprint
inline int
isprint(int __c) { return _S_isprint_helper(__c); }
#elif _GLIBCPP_USE_NAMESPACES
#else
inline int
isprint(int __c) { return ::isprint(__c); }
#endif
......@@ -100,7 +100,7 @@ namespace std
# undef iscntrl
inline int
iscntrl(int __c) { return _S_iscntrl_helper(__c); }
#elif _GLIBCPP_USE_NAMESPACES
#else
inline int
iscntrl(int __c) { return ::iscntrl(__c); }
#endif
......@@ -111,7 +111,7 @@ namespace std
# undef isupper
inline int
isupper(int __c) { return _S_isupper_helper(__c); }
#elif _GLIBCPP_USE_NAMESPACES
#else
inline int
isupper(int __c) { return ::isupper(__c); }
#endif
......@@ -122,7 +122,7 @@ namespace std
# undef islower
inline int
islower(int __c) { return _S_islower_helper(__c); }
#elif _GLIBCPP_USE_NAMESPACES
#else
inline int
islower(int __c) { return ::islower(__c); }
#endif
......@@ -133,7 +133,7 @@ namespace std
# undef isalpha
inline int
isalpha(int __c) { return _S_isalpha_helper(__c); }
#elif _GLIBCPP_USE_NAMESPACES
#else
inline int
isalpha(int __c) { return ::isalpha(__c); }
#endif
......@@ -144,7 +144,7 @@ namespace std
# undef isdigit
inline int
isdigit(int __c) { return _S_isdigit_helper(__c); }
#elif _GLIBCPP_USE_NAMESPACES
#else
inline int
isdigit(int __c) { return ::isdigit(__c); }
#endif
......@@ -155,7 +155,7 @@ namespace std
# undef ispunct
inline int
ispunct(int __c) { return _S_ispunct_helper(__c); }
#elif _GLIBCPP_USE_NAMESPACES
#else
inline int
ispunct(int __c) { return ::ispunct(__c); }
#endif
......@@ -166,7 +166,7 @@ namespace std
# undef isxdigit
inline int
isxdigit(int __c) { return _S_isxdigit_helper(__c); }
#elif _GLIBCPP_USE_NAMESPACES
#else
inline int
isxdigit(int __c) { return ::isxdigit(__c); }
#endif
......@@ -177,7 +177,7 @@ namespace std
# undef isalnum
inline int
isalnum(int __c) { return _S_isalnum_helper(__c); }
#elif _GLIBCPP_USE_NAMESPACES
#else
inline int
isalnum(int __c) { return ::isalnum(__c); }
#endif
......@@ -188,7 +188,7 @@ namespace std
# undef isgraph
inline int
isgraph(int __c) { return _S_isgraph_helper(__c); }
#elif _GLIBCPP_USE_NAMESPACES
#else
inline int
isgraph(int __c) { return ::isgraph(__c); }
#endif
......
......@@ -42,203 +42,203 @@
namespace std {
inline long
abs(long __l) { return ::labs(__l); }
inline long
abs(long __l) { return ::labs(__l); }
inline ldiv_t
div(long __a, long __b) { return ::ldiv(__a, __b); }
inline ldiv_t
div(long __a, long __b) { return ::ldiv(__a, __b); }
// double
inline double
abs(double __x) { return ::fabs(__x); }
// double
inline double
abs(double __x) { return ::fabs(__x); }
double
pow(double, int);
double
pow(double, int);
// float
inline float
ceil(float __x) { return ::ceil(static_cast<double>(__x)); }
// float
inline float
ceil(float __x) { return ::ceil(static_cast<double>(__x)); }
inline float
floor(float __x) { return ::floor(static_cast<double>(__x)); }
inline float
floor(float __x) { return ::floor(static_cast<double>(__x)); }
inline float
fmod(float __x, float __y)
{ return ::fmod(static_cast<double>(__x), static_cast<double>(__y)); }
inline float
fmod(float __x, float __y)
{ return ::fmod(static_cast<double>(__x), static_cast<double>(__y)); }
inline float
frexp(float __x, int* __p)
{ return ::frexp(static_cast<double>(__x), __p); }
inline float
frexp(float __x, int* __p)
{ return ::frexp(static_cast<double>(__x), __p); }
inline float
ldexp(float __x, int __i)
{ return ::ldexp(static_cast<double>(__x), __i); }
inline float
ldexp(float __x, int __i)
{ return ::ldexp(static_cast<double>(__x), __i); }
inline float
pow(float __x, float __y)
{ return ::pow(static_cast<double>(__x), static_cast<double>(__y)); }
inline float
pow(float __x, float __y)
{ return ::pow(static_cast<double>(__x), static_cast<double>(__y)); }
float
pow(float, int);
float
pow(float, int);
#if _GLIBCPP_HAVE_ABSF
inline float
abs(float __x) { return ::absf(__x); }
inline float
abs(float __x) { return ::absf(__x); }
#else
inline float
abs(float __x) { return ::fabs(static_cast<double>(__x)); }
inline float
abs(float __x) { return ::fabs(static_cast<double>(__x)); }
#endif
#if _GLIBCPP_HAVE_ACOSF
inline float
acos(float __x) { return ::acosf(__x); }
inline float
acos(float __x) { return ::acosf(__x); }
#else
inline float
acos(float __x) { return ::acos(static_cast<double>(__x)); }
inline float
acos(float __x) { return ::acos(static_cast<double>(__x)); }
#endif
#if _GLIBCPP_HAVE_ASINF
inline float
asin(float __x) { return ::asinf(__x); }
inline float
asin(float __x) { return ::asinf(__x); }
#else
inline float
asin(float __x) { return ::asin(static_cast<double>(__x)); }
inline float
asin(float __x) { return ::asin(static_cast<double>(__x)); }
#endif
#if _GLIBCPP_HAVE_ATANF
inline float
atan(float __x) { return ::atanf(__x); }
inline float
atan(float __x) { return ::atanf(__x); }
#else
inline float
atan(float __x) { return ::atan(static_cast<double>(__x)); }
inline float
atan(float __x) { return ::atan(static_cast<double>(__x)); }
#endif
#if _GLIBCPP_HAVE_ATAN2F
inline float
atan2(float __x, float __y) { return ::atan2f(__x, __y); }
inline float
atan2(float __x, float __y) { return ::atan2f(__x, __y); }
#else
inline float
atan2(float __x, float __y)
{ return ::atan2(static_cast<double>(__x), static_cast<double>(__y)); }
inline float
atan2(float __x, float __y)
{ return ::atan2(static_cast<double>(__x), static_cast<double>(__y)); }
#endif
#if _GLIBCPP_HAVE_TANF
inline float
tan(float __x) { return ::tanf(__x); }
inline float
tan(float __x) { return ::tanf(__x); }
#else
inline float
tan(float __x) { return ::tan(static_cast<double>(__x)); }
inline float
tan(float __x) { return ::tan(static_cast<double>(__x)); }
#endif
#if _GLIBCPP_HAVE_SINHF
inline float
sinh(float __x) { return ::sinhf(__x); }
inline float
sinh(float __x) { return ::sinhf(__x); }
#else
inline float
sinh(float __x) { return ::sinh(static_cast<double>(__x)); }
inline float
sinh(float __x) { return ::sinh(static_cast<double>(__x)); }
#endif
#if _GLIBCPP_HAVE_TANHF
inline float
tanh(float __x) { return ::tanhf(__x); }
inline float
tanh(float __x) { return ::tanhf(__x); }
#else
inline float
tanh(float __x) { return ::tanh(static_cast<double>(__x)); }
inline float
tanh(float __x) { return ::tanh(static_cast<double>(__x)); }
#endif
#if _GLIBCPP_HAVE_COSHF
inline float
cosh(float __x) { return ::coshf(__x); }
inline float
cosh(float __x) { return ::coshf(__x); }
#else
inline float
cosh(float __x) { return ::cosh(static_cast<double>(__x)); }
inline float
cosh(float __x) { return ::cosh(static_cast<double>(__x)); }
#endif
#if _GLIBCPP_HAVE_EXPF
inline float
exp(float __x) { return ::expf(__x); }
inline float
exp(float __x) { return ::expf(__x); }
#else
inline float
exp(float __x) { return ::exp(static_cast<double>(__x)); }
inline float
exp(float __x) { return ::exp(static_cast<double>(__x)); }
#endif
#if _GLIBCPP_HAVE_LOGF
inline float
log(float __x) { return ::logf(__x); }
inline float
log(float __x) { return ::logf(__x); }
#else
inline float
log(float __x) { return ::log(static_cast<double>(__x)); }
inline float
log(float __x) { return ::log(static_cast<double>(__x)); }
#endif
#if _GLIBCPP_HAVE_LOG10F
inline float
log10(float __x) { return ::log10f(__x); }
inline float
log10(float __x) { return ::log10f(__x); }
#else
inline float
log10(float __x) { return ::log10(static_cast<double>(__x)); }
inline float
log10(float __x) { return ::log10(static_cast<double>(__x)); }
#endif
#if _GLIBCPP_HAVE_MODFF
inline float
modf(float __x, float* __p) { return ::modff(__x, __p); }
inline float
modf(float __x, float* __p) { return ::modff(__x, __p); }
#else
inline float
modf(float __x, float* __p)
{
double __tmp;
double __res = ::modf(static_cast<double>(__x), &__tmp);
*__p = static_cast<float> (__tmp);
return __res;
}
inline float
modf(float __x, float* __p)
{
double __tmp;
double __res = ::modf(static_cast<double>(__x), &__tmp);
*__p = static_cast<float> (__tmp);
return __res;
}
#endif
#if GLIBCPP_HAS_BUILTIN_SINF
inline float
sin(float __x) { return __builtin_sinf(__x); }
inline float
sin(float __x) { return __builtin_sinf(__x); }
#elif _GLIBCPP_HAVE_SINF
inline float
sin(float __x) { return ::sinf(__x); }
inline float
sin(float __x) { return ::sinf(__x); }
#else
inline float
sin(float __x) { return ::sin(static_cast<double>(__x)); }
inline float
sin(float __x) { return ::sin(static_cast<double>(__x)); }
#endif
#if GLIBCPP_HAS_BUILTIN_COSF
inline float
cos(float __x) { return __builtin_cosf(__x); }
inline float
cos(float __x) { return __builtin_cosf(__x); }
#elif _GLIBCPP_HAVE_COSF
inline float
cos(float __x) { return ::cosf(__x); }
inline float
cos(float __x) { return ::cosf(__x); }
#else
inline float
cos(float __x) { return ::cos(static_cast<double>(__x)); }
inline float
cos(float __x) { return ::cos(static_cast<double>(__x)); }
#endif
#if GLIBCPP_HAS_BUILTIN_FABSF
inline float
fabs(float __x) { return __builtin_fabsf(__x); }
inline float
fabs(float __x) { return __builtin_fabsf(__x); }
#elif _GLIBCPP_HAVE_FABSF
inline float
fabs(float __x) { return ::fabsf(__x); }
inline float
fabs(float __x) { return ::fabsf(__x); }
#else
inline float
fabs(float __x) { return ::fabs(static_cast<double>(__x)); }
inline float
fabs(float __x) { return ::fabs(static_cast<double>(__x)); }
#endif
#if GLIBCPP_HAS_BUILTIN_SQRTF
inline float
sqrt(float __x) { return __builtin_sqrtf(__x); }
inline float
sqrt(float __x) { return __builtin_sqrtf(__x); }
#elif _GLIBCPP_HAVE_SQRTF
inline float
sqrt(float __x) { return ::sqrtf(__x); }
inline float
sqrt(float __x) { return ::sqrtf(__x); }
#else
inline float
sqrt(float __x) { return ::fabs(static_cast<double>(__x)); }
inline float
sqrt(float __x) { return ::fabs(static_cast<double>(__x)); }
#endif
// XXX long double
long double
pow(long double, int);
// XXX long double
long double
pow(long double, int);
} // std
......
......@@ -3,13 +3,6 @@
/* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP
// If using the namespace std, you need this. Eventually this should
// not be an option. In the meantime, and as things like std_ctype.h
// need to be hacked out, give people the option. If this is set to 1,
// CXXFLAGS should include -fhonor-std. If this is undefined, CXXFLAGS
// should include -fno-honor-std.
#undef _GLIBCPP_USE_NAMESPACES
// Include support for 'long long' and 'unsigned long long'.
#undef _GLIBCPP_USE_LONG_LONG
......
/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
/* Copyright (C) 1997-1999, 2000 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
......@@ -82,7 +82,5 @@ double cabs (__complex__ double x);
float cabsf (__complex__ float x);
long double cabsl (__complex__ long double x);
double nan (void);
#endif
/* Configuration data for libmath subpart of libstdc++. */
/* Copyright (C) 1997-1999 Free Software Foundation, Inc.
/* Copyright (C) 1997-1999, 2000 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
......@@ -74,6 +74,11 @@ typedef int Int32_t __attribute ((mode (SI)));
# include <nan.h>
#endif
#ifndef NAN
# define NAN (nan())
double nan (void);
#endif
#ifdef _GLIBCPP_HAVE_IEEEFP_H
# include <ieeefp.h>
#endif
......@@ -117,10 +122,6 @@ typedef int Int32_t __attribute ((mode (SI)));
# endif
#endif
#ifndef NAN
# define NAN (nan())
#endif
#ifndef M_PI
# define M_PI 3.14159265358979323846
#endif
......@@ -327,15 +328,10 @@ do { \
/* Replacement for non-existing float functions. */
#ifndef _GLIBCPP_HAVE_FABSF
# ifdef __GNUC__
/* gcc has fabsf as a builtin command. */
extern float fabsf (float);
# else
# define fabsf(x) fabs (x)
# endif
#if !defined(_GLIBCPP_HAVE_FABSF) && !defined(_GLIBCPP_HAS_BUILTIN_FABSF)
# define fabsf(x) fabs (x)
#endif
#ifndef _GLIBCPP_HAVE_COSF
#if !defined(_GLIBCPP_HAVE_COSF) && !defined(_GLIBCPP_HAS_BUILTIN_COSF)
# define cosf(x) cos (x)
#endif
#ifndef _GLIBCPP_HAVE_COSHF
......@@ -353,13 +349,13 @@ extern float fabsf (float);
#ifndef _GLIBCPP_HAVE_POWF
# define powf(x, y) pow (x, y)
#endif
#ifndef _GLIBCPP_HAVE_SINF
#if !defined(_GLIBCPP_HAVE_SINF) && !defined(_GLIBCPP_HAS_BUILTIN_SINF)
# define sinf(x) sin (x)
#endif
#ifndef _GLIBCPP_HAVE_SINHF
# define sinhf(x) sinh (x)
#endif
#ifndef _GLIBCPP_HAVE_SQRTF
#if !defined(_GLIBCPP_HAVE_SQRTF) && !defined(_GLIBCPP_HAS_BUILTIN_SQRTF)
# define sqrtf(x) sqrt (x)
#endif
#ifndef _GLIBCPP_HAVE_TANF
......@@ -375,7 +371,3 @@ extern float fabsf (float);
#ifdef __cplusplus
}
#endif
// 1999-09-20 bkoz
// Copyright (C) 1999 Free Software Foundation, Inc.
// Copyright (C) 1999, 2000 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
......@@ -30,20 +30,16 @@
// 27.6.1.1 basic_istream
// NB: This file is for testing istream with NO OTHER INCLUDES.
// XXX only if using namespaces, as without leads to duplicate symbols
#if _GLIBCPP_USE_NAMESPACES
#include <istream>
#include <bits/basic_ios.tcc> // XXX Hack, in a perfect world this not needed.
#include <locale> // XXX As above, needed for ctype/num_get use_facets(...)
#include <bits/locale_facets.tcc> // XXX
namespace test {
#if 0
// XXX Should work, but doesn't.
using namespace std;
typedef short type_t;
template class basic_istream<type_t, char_traits<type_t> >;
#if 0
template
const ctype<type_t>&
use_facet<ctype<type_t> >(const locale&);
......@@ -55,7 +51,6 @@ namespace test {
#endif
} // test
#endif
int main() {
return 0;
......
// 1999-09-20 bkoz
// Copyright (C) 1999 Free Software Foundation, Inc.
// Copyright (C) 1999, 2000 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
......@@ -30,21 +30,18 @@
// 27.6.2.1 basic_ostream
// NB: This file is for testing ostream with NO OTHER INCLUDES.
// XXX only if using namespaces, as without leads to duplicate symbols
#if _GLIBCPP_USE_NAMESPACES
#include <ostream>
#include <bits/basic_ios.tcc> // XXX Hack, in a perfect world this not needed.
#include <locale> // XXX As above, needed for ctype/num_get use_facets(...)
#include <bits/locale_facets.tcc>
namespace test {
#if 0
// XXX Should work, but doesn't.
using namespace std;
typedef short type_t;
template class basic_ostream<type_t, char_traits<type_t> >;
#endif
} // test
#endif
int main() {
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