summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include
diff options
context:
space:
mode:
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2001-04-20 08:59:25 +0000
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2001-04-20 08:59:25 +0000
commit08078d479d75da325e154dc46441ac79949a35c2 (patch)
treef895b431b6a7bf322998be355dddd14b09763a4b /libstdc++-v3/include
parenta3ad289ca1bfeaa87fe51b73353bf5e385a50b34 (diff)
downloadgcc-08078d479d75da325e154dc46441ac79949a35c2.tar.gz
2001-04-19 Benjamin Kosnik <bkoz@redhat.com>
* acconfig.h (_GLIBCPP_USE_C99): Add. * config.h.in: Regenerate. * acinclude.m4 (GLIBCPP_ENABLE_C99): New macro. Test for ISO/IEC 9899: 1999 support. * aclocal.m4: Regenerate. * configure.in (GLIBCPP_ENABLE_C99): Use it, on by default. * configure: Regenerate. * configure.in (GLIBCPP_ENABLE_LONG_LONG): Set default to yes. * configure: Regenerate. * include/c_std/bits/std_cwchar.h: Put wcstold, wcstoll, wcstoull into c99. * include/c_std/bits/std_cmath.h: Bring C99 functions into c99 namespace. * include/c_std/bits/std_cstdlib.h: Same. * docs/html/configopts.html: Update. * testsuite/26_numerics/c99_macros.cc: Edit, use cmath instead of math.h (test_c99_classify): Add. * config/os/gnu-linux/bits/os_defines.h (_GNU_SOURCE): Remove. (_ISOC99_SOURCE): Remove. * include/bits/stl_algo.h: Use _GLIBCPP_HAVE_DRAND48. * include/bits/c++config (__STL_ASSERTIONS): Simplify. * acinclude.m4 (GLIBCPP_CHECK_STDLIB_SUPPORT): Add check for drand48. * aclocal.m4: Regenerate. * configure: Regenerate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@41451 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r--libstdc++-v3/include/bits/c++config96
-rw-r--r--libstdc++-v3/include/bits/stl_algo.h7
-rw-r--r--libstdc++-v3/include/c_std/bits/std_cmath.h148
-rw-r--r--libstdc++-v3/include/c_std/bits/std_cstdlib.h30
-rw-r--r--libstdc++-v3/include/c_std/bits/std_cwchar.h11
5 files changed, 181 insertions, 111 deletions
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index ad72c1fdc3c..e1571061e72 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -49,6 +49,10 @@
// by the compiler, but instead instantiated into the library binary.
#define _GLIBCPP_FULLY_COMPLIANT_HEADERS 1
+// Define this to permit user-level control of the expansion of string
+// buffers (via a fn pointer), see basic_string.* for more.
+//#define _GLIBCPP_ALLOC_CONTROL
+
// To enable older, ARM-style iostreams and other anachronisms use this.
//#define _GLIBCPP_DEPRECATED 1
@@ -59,86 +63,54 @@
//#define _GLIBCPP_CONCEPT_CHECKS 1
// From SGI's stl_config.h; generic settings and user hooks (_NOTHREADS).
+#ifdef _REENTRANT
+# define __STL_THREADS
+#endif
+
#if defined(_PTHREADS) && !defined(_NOTHREADS)
-# define __STL_PTHREADS
+# define __STL_PTHREADS
#endif
+
#if defined(_UITHREADS) && !defined(_PTHREADS) && !defined(_NOTHREADS)
-# define __STL_UITHREADS
+# define __STL_UITHREADS
+#endif
+
+#if defined(__STL_WIN32THREADS) || defined(__STL_SGI_THREADS) \
+ || defined(__STL_PTHREADS) || defined(__STL_UITHREADS)
+# define __STL_THREADS
+# define __STL_VOLATILE volatile
+#else
+# define __STL_VOLATILE
#endif
// This is also a user hook, but via -f[no-]exceptions, not direct #defines.
#ifdef __EXCEPTIONS
-# define __STL_USE_EXCEPTIONS
-# define __STL_TRY try
-# define __STL_CATCH_ALL catch(...)
-# define __STL_THROW(x) throw x
-# define __STL_RETHROW throw
-# define __STL_NOTHROW throw()
-# define __STL_UNWIND(action) catch(...) { action; throw; }
+# define __STL_USE_EXCEPTIONS
+# define __STL_TRY try
+# define __STL_CATCH_ALL catch(...)
+# define __STL_THROW(x) throw x
+# define __STL_RETHROW throw
+# define __STL_NOTHROW throw()
+# define __STL_UNWIND(action) catch(...) { action; throw; }
#else
-# define __STL_TRY
-# define __STL_CATCH_ALL if (false)
-# define __STL_THROW(x)
-# define __STL_RETHROW
-# define __STL_NOTHROW
-# define __STL_UNWIND(action)
+# define __STL_TRY
+# define __STL_CATCH_ALL if (false)
+# define __STL_THROW(x)
+# define __STL_RETHROW
+# define __STL_NOTHROW
+# define __STL_UNWIND(action)
#endif
// This is the "underlying allocator" for STL. The alternatives are
// homegrown schemes involving a kind of mutex and free list; see stl_alloc.h.
#define __USE_MALLOC
-// Define this to permit user-level control of the expansion of string
-// buffers (via a fn pointer), see basic_string.* for more.
-//#define _GLIBCPP_ALLOC_CONTROL
-
// The remainder of the prewritten config is mostly automatic; all the
// user hooks are listed above.
-#ifdef _REENTRANT
-# define __STL_THREADS
-#endif
-#ifdef _PTHREADS
-# define __STL_PTHREADS
-#endif
-//#ifndef __STRICT_ANSI__
-//# define __STL_LONG_LONG
-//#endif
-
-// Mingw32, GCC compiler using the Microsoft C runtime (settings taken from
-// SGI's stl_config.h)
-#if defined(__MINGW32__)
-# define __STL_NO_DRAND48
-# ifdef _MT
-# define __STL_WIN32THREADS
-# endif
-#endif
-
-// Cygwin32, GCC compiler on MS Windows (settings taken from SGI's
-// stl_config.h)
-#if defined(__CYGWIN__)
-# define __STL_NO_DRAND48
-#endif
-
-// XXX Only used in the SGI rope extensions; this is from stl_config.h and
+// XXX
+// Only used in the SGI rope extensions; this is from stl_config.h and
// should be cleaned up.
-#ifdef __STL_ASSERTIONS
-# include <stdio.h>
-# define __stl_assert(expr) \
- if (!(expr)) { fprintf(stderr, "%s:%d STL assertion failure: %s\n", \
- __FILE__, __LINE__, # expr); abort(); }
-#else
# define __stl_assert(expr)
-#endif
-
-
-#if defined(__STL_WIN32THREADS) || defined(__STL_SGI_THREADS) \
- || defined(__STL_PTHREADS) || defined(__STL_UITHREADS)
-# define __STL_THREADS
-# define __STL_VOLATILE volatile
-#else
-# define __STL_VOLATILE
-#endif
-
// End of prewritten config; the discovered settings follow.
diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h
index 43537248448..a1bd83cdc85 100644
--- a/libstdc++-v3/include/bits/stl_algo.h
+++ b/libstdc++-v3/include/bits/stl_algo.h
@@ -1088,13 +1088,12 @@ _OutputIter rotate_copy(_ForwardIter __first, _ForwardIter __middle,
// Return a random number in the range [0, __n). This function encapsulates
// whether we're using rand (part of the standard C library) or lrand48
// (not standard, but a much better choice whenever it's available).
-
template <class _Distance>
inline _Distance __random_number(_Distance __n) {
-#ifdef __STL_NO_DRAND48
- return rand() % __n;
-#else
+#ifdef _GLIBCPP_HAVE_DRAND48
return lrand48() % __n;
+#else
+ return rand() % __n;
#endif
}
diff --git a/libstdc++-v3/include/c_std/bits/std_cmath.h b/libstdc++-v3/include/c_std/bits/std_cmath.h
index db3e47f6f20..9ec828493e6 100644
--- a/libstdc++-v3/include/c_std/bits/std_cmath.h
+++ b/libstdc++-v3/include/c_std/bits/std_cmath.h
@@ -67,24 +67,6 @@
#undef tan
#undef tanh
-// These are possible macros imported from C99-land. They tend to break
-// well-formed C++ programs. Just pretend we don't know about them.
-// At some point, we should provide extensions in std:: -- Gaby
-
-#undef fpclassify
-#undef isfinite
-#undef isinf
-#undef isnan
-#undef isnormal
-#undef signbit
-
-#undef isgreater
-#undef isgreaterequal
-#undef isless
-#undef islessequal
-#undef islessgreater
-#undef isunordered
-
namespace std
{
// Forward declaration of a helper function. This really should be
@@ -619,6 +601,136 @@ namespace std
#endif
} // std
+
+#if _GLIBCPP_USE_C99
+// These are possible macros imported from C99-land. For strict
+// conformance, remove possible C99-injected names from the
+// global namespace, and sequester them in the c99 namespace.
+namespace c99
+{
+ template<typename _Tp>
+ int
+ __capture_fpclassify(_Tp __f) { return fpclassify(__f); }
+
+ template<typename _Tp>
+ int
+ __capture_isfinite(_Tp __f) { return isfinite(__f); }
+
+ template<typename _Tp>
+ int
+ __capture_isinf(_Tp __f) { return isinf(__f); }
+
+ template<typename _Tp>
+ int
+ __capture_isnan(_Tp __f) { return isnan(__f); }
+
+ template<typename _Tp>
+ int
+ __capture_isnormal(_Tp __f) { return isnormal(__f); }
+
+ template<typename _Tp>
+ int
+ __capture_signbit(_Tp __f) { return signbit(__f); }
+
+ template<typename _Tp>
+ int
+ __capture_isgreater(_Tp __f1, _Tp __f2) { return isgreater(__f1, __f2); }
+
+ template<typename _Tp>
+ int
+ __capture_isgreaterequal(_Tp __f1, _Tp __f2)
+ { return isgreaterequal(__f1, __f2); }
+
+ template<typename _Tp>
+ int
+ __capture_isless(_Tp __f1, _Tp __f2) { return isless(__f1, __f2); }
+
+ template<typename _Tp>
+ int
+ __capture_islessequal(_Tp __f1, _Tp __f2)
+ { return islessequal(__f1, __f2); }
+
+ template<typename _Tp>
+ int
+ __capture_islessgreater(_Tp __f1, _Tp __f2)
+ { return islessgreater(__f1, __f2); }
+
+ template<typename _Tp>
+ int
+ __capture_isunordered(_Tp __f1, _Tp __f2)
+ { return isunordered(__f1, __f2); }
+} // namespace c99
+#endif
+
+#undef fpclassify
+#undef isfinite
+#undef isinf
+#undef isnan
+#undef isnormal
+#undef signbit
+#undef isgreater
+#undef isgreaterequal
+#undef isless
+#undef islessequal
+#undef islessgreater
+#undef isunordered
+
+#if _GLIBCPP_USE_C99
+namespace c99
+{
+ template<typename _Tp>
+ int
+ fpclassify(_Tp __f) { return __capture_fpclassify(__f); }
+
+ template<typename _Tp>
+ int
+ isfinite(_Tp __f) { return __capture_isfinite(__f); }
+
+ template<typename _Tp>
+ int
+ isinf(_Tp __f) { return __capture_isinf(__f); }
+
+ template<typename _Tp>
+ int
+ isnan(_Tp __f) { return __capture_isnan(__f); }
+
+ template<typename _Tp>
+ int
+ isnormal(_Tp __f) { return __capture_isnormal(__f); }
+
+ template<typename _Tp>
+ int
+ signbit(_Tp __f) { return __capture_signbit(__f); }
+
+ template<typename _Tp>
+ int
+ isgreater(_Tp __f1, _Tp __f2) { return __capture_isgreater(__f1, __f2); }
+
+ template<typename _Tp>
+ int
+ isgreaterequal(_Tp __f1, _Tp __f2)
+ { return __capture_isgreaterequal(__f1, __f2); }
+
+ template<typename _Tp>
+ int
+ isless(_Tp __f1, _Tp __f2) { return __capture_isless(__f1, __f2); }
+
+ template<typename _Tp>
+ int
+ islessequal(_Tp __f1, _Tp __f2)
+ { return __capture_islessequal(__f1, __f2); }
+
+ template<typename _Tp>
+ int
+ islessgreater(_Tp __f) { return __capture_islessgreater(__f); }
+
+ template<typename _Tp>
+ int
+ isunordered(_Tp __f1, _Tp __f2)
+ { return __capture_isunordered(__f1, __f2); }
+}
+#endif
+
#ifdef _GLIBCPP_NO_TEMPLATE_EXPORT
# define export
# include <bits/cmath.tcc>
diff --git a/libstdc++-v3/include/c_std/bits/std_cstdlib.h b/libstdc++-v3/include/c_std/bits/std_cstdlib.h
index 8b7776db3ba..b8365e024f2 100644
--- a/libstdc++-v3/include/c_std/bits/std_cstdlib.h
+++ b/libstdc++-v3/include/c_std/bits/std_cstdlib.h
@@ -85,18 +85,6 @@ namespace std
using ::div_t;
using ::ldiv_t;
-#ifdef _GLIBCPP_USE_LONG_LONG
-# ifdef _GLIBCPP_HAVE_LLDIV_T
- using ::lldiv_t;
-# else
- struct lldiv_t
- {
- long long quot;
- long long rem;
- };
-# endif
-#endif
-
extern "C" double atof(const char*);
extern "C" int atoi(const char*);
extern "C" long int atol(const char*);
@@ -135,8 +123,13 @@ namespace std
inline ldiv_t
div(long __i, long __j) { return ::ldiv(__i, __j); }
+} // namespace std
+
+#if _GLIBCPP_USE_C99
+namespace c99
+{
+ using ::lldiv_t;
-#ifdef _GLIBCPP_USE_LONG_LONG
inline long long
abs(long long __x) { return __x >= 0 ? __x : -__x; }
@@ -154,18 +147,11 @@ namespace std
extern "C" long long int atoll(const char*);
extern "C" long long int strtoll(const char*, char**, int);
extern "C" unsigned long long int strtoull(const char*, char**, int);
-#endif
#ifdef _GLIBCPP_HAVE_STRTOLD
extern "C" long double strtold(const char*, char**);
#endif
-}
+} // namespace c99
+#endif
#endif
-
-
-
-
-
-
-
diff --git a/libstdc++-v3/include/c_std/bits/std_cwchar.h b/libstdc++-v3/include/c_std/bits/std_cwchar.h
index e9e987adfd7..4bf8c8338f4 100644
--- a/libstdc++-v3/include/c_std/bits/std_cwchar.h
+++ b/libstdc++-v3/include/c_std/bits/std_cwchar.h
@@ -46,7 +46,6 @@
#include <wchar.h>
#endif
-
// Need to do a bit of trickery here with mbstate_t as char_traits
// assumes it is in wchar.h, regardless of wchar_t specializations.
#ifndef _GLIBCPP_HAVE_MBSTATE_T
@@ -192,19 +191,21 @@ namespace std
return const_cast<wchar_t*>(wmemchr(const_cast<const wchar_t*>(__p), __c, __n));
}
extern "C" int wmemcmp(const wchar_t*, const wchar_t*, size_t);
- //extern "C" int wmemcmp(wchar_t*, const wchar_t*, size_t);
extern "C" wchar_t* wmemcpy(wchar_t*, const wchar_t*, size_t);
extern "C" wchar_t* wmemmove(wchar_t*, const wchar_t*, size_t);
extern "C" wchar_t* wmemset(wchar_t*, wchar_t, size_t);
extern "C" size_t wcsftime(wchar_t*, size_t, const wchar_t*, const struct tm*);
+}
-#if 0
- // Full C99 listing
+#if _GLIBCPP_USE_C99
+namespace c99
+{
extern "C" long double wcstold(const wchar_t*, wchar_t**);
extern "C" long long int wcstoll(const wchar_t*, wchar_t**, int);
extern "C" unsigned long long int wcstoull(const wchar_t*, wchar_t**, int);
-#endif
}
+#endif
+
#endif //_GLIBCPP_USE_WCHAR_T
#endif