This is the mail archive of the
libstdc++@sources.redhat.com
mailing list for the libstdc++ project.
[v3] default to --disable-long-long, ctype fixes
- To: gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Subject: [v3] default to --disable-long-long, ctype fixes
- From: Benjamin Kosnik <bkoz at redhat dot com>
- Date: Tue, 19 Dec 2000 14:47:33 -0800
This change turns off long long support in libstdc++-v3 by default. To
enable it, it is now required to use --enable-long-long.
Long long support is not officially part of the standard C++ library
anyway, if we're being pedantic. It is useful, so that's why the
relevant bits were added to begin with.
I'm doing this because I can find no way to mesh C includes with C++
includes for the default case at this time. In particular, stdlib.h
should deal with lldiv_t when long long is enabled, and cstdlib should
put this into namespace std. This was a problem when users of
libstdc++-v3 would do things like
#include <stdlib.h>
#include <iostream.h>
with a plain-jane compile line, where lldiv_t would not be declared in
"C" scope, because _GNU_SOURCE wasn't defined to enable the ISO_C99
parts of the headers.
How to use long long correctly with the c++ libraries:
1) If a user now enables long long support, and uses C++ headers like
<cstdlib>, this problem will go away. (as --enable-long long
2) and/or: It's hoped that if users --enable-long-long, then they will
also use -D_GNU_SOURCE (or whatever system-dependent macros necessary
on the host system) on their compile lines, which turns on support for
long long in the "C" headers under linux.
-benjamin
x86/linux
2000-12-19 Benjamin Kosnik <bkoz@fillmore.constant.com>
* configure.in: Don't turn on long long by default.
* configure: Regenerate.
* include/c/bits/std_cstdio.h: Remove c++config.h include.
* src/locale.cc: Formatting tweaks.
* testsuite/22_locale/ctype.cc (char<unsigned char>): Provide
member functions.
Index: configure.in
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/configure.in,v
retrieving revision 1.41
diff -c -p -r1.41 configure.in
*** configure.in 2000/12/18 18:03:07 1.41
--- configure.in 2000/12/19 22:31:42
*************** GLIBCPP_CHECK_COMPILER_VERSION
*** 36,42 ****
GLIBCPP_ENABLE_DEBUG($USE_MAINTAINER_MODE)
GLIBCPP_ENABLE_CSTDIO
GLIBCPP_ENABLE_C_MBCHAR([yes])
! GLIBCPP_ENABLE_LONG_LONG([yes])
GLIBCPP_ENABLE_SHADOW([no])
GLIBCPP_ENABLE_THREADS
GLIBCPP_ENABLE_ATOMICITY
--- 36,42 ----
GLIBCPP_ENABLE_DEBUG($USE_MAINTAINER_MODE)
GLIBCPP_ENABLE_CSTDIO
GLIBCPP_ENABLE_C_MBCHAR([yes])
! GLIBCPP_ENABLE_LONG_LONG([no])
GLIBCPP_ENABLE_SHADOW([no])
GLIBCPP_ENABLE_THREADS
GLIBCPP_ENABLE_ATOMICITY
Index: include/c/bits/std_cstdio.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/include/c/bits/std_cstdio.h,v
retrieving revision 1.5
diff -c -p -r1.5 std_cstdio.h
*** std_cstdio.h 2000/12/14 19:06:57 1.5
--- std_cstdio.h 2000/12/19 22:31:42
***************
*** 36,42 ****
#ifndef _CPP_CSTDIO
#define _CPP_CSTDIO 1
- #include <bits/c++config.h>
#include <bits/std_cstdarg.h>
#pragma GCC system_header
--- 36,41 ----
Index: src/locale.cc
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/src/locale.cc,v
retrieving revision 1.22
diff -c -p -r1.22 locale.cc
*** locale.cc 2000/12/14 07:20:37 1.22
--- locale.cc 2000/12/19 22:31:45
*************** namespace std {
*** 950,957 ****
return __ret;
};
! ctype<wchar_t>::
! ~ctype() { }
// NB: These ctype<wchar_t> methods are not configuration-specific,
// unlike the ctype<char> bits.
--- 950,956 ----
return __ret;
};
! ctype<wchar_t>::~ctype() { }
// NB: These ctype<wchar_t> methods are not configuration-specific,
// unlike the ctype<char> bits.
Index: testsuite/22_locale/ctype.cc
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/testsuite/22_locale/ctype.cc,v
retrieving revision 1.2
diff -c -p -r1.2 ctype.cc
*** ctype.cc 2000/12/14 07:20:37 1.2
--- ctype.cc 2000/12/19 22:31:45
*************** int mask ();
*** 27,33 ****
#include <locale>
// 2: Should be able to instantiate this for other types besides char, wchar_t
! class gnu_ctype: public std::ctype<unsigned char> { };
gnu_ctype facet01;
// 3: Sanity check ctype_base::mask bitmask requirements
--- 27,135 ----
#include <locale>
// 2: Should be able to instantiate this for other types besides char, wchar_t
! typedef std::ctype<char> cctype;
!
! class gnu_ctype: public std::ctype<unsigned char>
! {
! private:
! const cctype& _M_cctype;
!
! public:
! explicit
! gnu_ctype(size_t __refs = 0)
! : std::ctype<unsigned char>(__refs),
! _M_cctype(std::use_facet<cctype>(std::locale::classic()))
! { }
!
! ~gnu_ctype();
!
! protected:
! virtual bool
! do_is(mask __m, char_type __c) const
! { return _M_cctype.is(__m, __c); }
!
! virtual const char_type*
! do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const
! {
! const char* __c = _M_cctype.is(reinterpret_cast<const char*>(__lo),
! reinterpret_cast<const char*>(__hi), __vec);
! return reinterpret_cast<const char_type*>(__c);
! }
!
! virtual const char_type*
! do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const
! {
! const char* __c = _M_cctype.scan_is(__m,
! reinterpret_cast<const char*>(__lo),
! reinterpret_cast<const char*>(__hi));
! return reinterpret_cast<const char_type*>(__c);
! }
!
! virtual const char_type*
! do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
! {
! const char* __c = _M_cctype.scan_is(__m,
! reinterpret_cast<const char*>(__lo),
! reinterpret_cast<const char*>(__hi));
! return reinterpret_cast<const char_type*>(__c);
! }
!
! virtual char_type
! do_toupper(char_type __c) const
! { return _M_cctype.toupper(__c); }
!
! virtual const char_type*
! do_toupper(char_type* __lo, const char_type* __hi) const
! {
! const char* __c = _M_cctype.toupper(reinterpret_cast<char*>(__lo),
! reinterpret_cast<const char*>(__hi));
! return reinterpret_cast<const char_type*>(__c);
! }
!
! virtual char_type
! do_tolower(char_type __c) const
! { return _M_cctype.tolower(__c); }
!
! virtual const char_type*
! do_tolower(char_type* __lo, const char_type* __hi) const
! {
! const char* __c = _M_cctype.toupper(reinterpret_cast<char*>(__lo),
! reinterpret_cast<const char*>(__hi));
! return reinterpret_cast<const char_type*>(__c);
! }
!
! virtual char_type
! do_widen(char __c) const
! { return _M_cctype.widen(__c); }
!
! virtual const char*
! do_widen(const char* __lo, const char* __hi, char_type* __dest) const
! {
! const char* __c = _M_cctype.widen(reinterpret_cast<const char*>(__lo),
! reinterpret_cast<const char*>(__hi),
! reinterpret_cast<char*>(__dest));
! return __c;
! }
!
! virtual char
! do_narrow(char_type __c, char __dfault) const
! { return _M_cctype.narrow(__c, __dfault); }
!
! virtual const char_type*
! do_narrow(const char_type* __lo, const char_type* __hi, char __dfault,
! char* __dest) const
! {
! const char* __c = _M_cctype.narrow(reinterpret_cast<const char*>(__lo),
! reinterpret_cast<const char*>(__hi),
! __dfault,
! reinterpret_cast<char*>(__dest));
! return reinterpret_cast<const char_type*>(__c);
! }
!
! };
!
! gnu_ctype::~gnu_ctype() { }
!
gnu_ctype facet01;
// 3: Sanity check ctype_base::mask bitmask requirements
*************** test01()
*** 45,51 ****
m01 & m02;
m01 | m02;
m01 ^ m02;
! m01 ~ m02;
m01 &= m02;
m01 |= m02;
m01 ^= m02;
--- 147,153 ----
m01 & m02;
m01 | m02;
m01 ^ m02;
! ~m01;
m01 &= m02;
m01 |= m02;
m01 ^= m02;