Commit 563ae04f by Benjamin Kosnik Committed by Benjamin Kosnik

Fixups for EDG front end.


2004-04-06  Benjamin Kosnik  <bkoz@redhat.com>

	Fixups for EDG front end.
	* include/ext/rope: Instead of non-existent function
	_Data_allocate, use allocator's allocate. Use this.
	(namespace _Rope_constants): Move _S_max_rope_depth, and _Tag
	enumerations from _Rope_RopeRep here.
	* include/ext/ropeimpl.h: Same.
	* src/ext-inst.cc (_S_min_len): Fix up definition.

	* config/locale/gnu/ctype_members.cc: Qualify base class members
	with this.
	* config/locale/generic/ctype_members.cc: Same.
	* config/locale/gnu/messages_members.h: Same.
	* config/locale/generic/messages_members.h: Same.
	* src/ctype.cc: Same.
	* include/bits/codecvt.h: Same.

	* include/bits/boost_concept_check.h: Declare.
	(__error_type_must_be_an_unsigned_integer_type): Remove this.
	(__error_type_must_be_an_integer_type): Remove this.
	(__error_type_must_be_a_signed_integer_type): Remove this.

	* config/io/basic_file_stdio.cc (__basic_file::sys_open): Remove cast.

	* libsupc++/eh_alloc.cc (__cxa_free_exception): Add exception
	specification to definition.
	(__cxa_allocate_exception): Same.
	* libsupc++/eh_catch.cc (__cxa_begin_catch): Same.
	* libsupc++/eh_globals.cc (__cxa_get_globals_fast): Same.
	(__cxa_get_globals): Same.

	* libsupc++/del_op.cc: Add comment about freestanding.

From-SVN: r80475
parent 9104315a
2004-04-06 Benjamin Kosnik <bkoz@redhat.com>
Fixups for EDG front end.
* include/ext/rope: Instead of non-existent function
_Data_allocate, use allocator's allocate. Use this.
(namespace _Rope_constants): Move _S_max_rope_depth, and _Tag
enumerations from _Rope_RopeRep here.
* include/ext/ropeimpl.h: Same.
* src/ext-inst.cc (_S_min_len): Fix up definition.
* config/locale/gnu/ctype_members.cc: Qualify base class members
with this.
* config/locale/generic/ctype_members.cc: Same.
* config/locale/gnu/messages_members.h: Same.
* config/locale/generic/messages_members.h: Same.
* src/ctype.cc: Same.
* include/bits/codecvt.h: Same.
* include/bits/boost_concept_check.h: Declare.
(__error_type_must_be_an_unsigned_integer_type): Remove this.
(__error_type_must_be_an_integer_type): Remove this.
(__error_type_must_be_a_signed_integer_type): Remove this.
* config/io/basic_file_stdio.cc (__basic_file::sys_open): Remove cast.
* libsupc++/eh_alloc.cc (__cxa_free_exception): Add exception
specification to definition.
(__cxa_allocate_exception): Same.
* libsupc++/eh_catch.cc (__cxa_begin_catch): Same.
* libsupc++/eh_globals.cc (__cxa_get_globals_fast): Same.
(__cxa_get_globals): Same.
* libsupc++/del_op.cc: Add comment about freestanding.
2004-04-05 Paolo Carlini <pcarlini@suse.de>
* include/ext/mt_allocator.h (__mt_alloc<>::deallocate):
......
......@@ -202,12 +202,12 @@ namespace std
{
__basic_file* __ret = NULL;
const char* __c_mode = __gnu_internal::fopen_mode(__mode);
if (__c_mode && !this->is_open()
&& (_M_cfile = fdopen(__fd, __c_mode)))
if (__c_mode && !this->is_open() && (_M_cfile = fdopen(__fd, __c_mode)))
{
char* __buf = NULL;
_M_cfile_created = true;
if (__fd == 0)
setvbuf(_M_cfile, reinterpret_cast<char*>(NULL), _IONBF, 0);
setvbuf(_M_cfile, __buf, _IONBF, 0);
__ret = this;
}
return __ret;
......
// std::ctype implementation details, generic version -*- C++ -*-
// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
// Copyright (C) 2001, 2002, 2003, 2004 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
......@@ -45,8 +45,8 @@ namespace std
{
if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
{
_S_destroy_c_locale(_M_c_locale_ctype);
_S_create_c_locale(_M_c_locale_ctype, __s);
this->_S_destroy_c_locale(this->_M_c_locale_ctype);
this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
}
}
......
// std::messages implementation details, generic version -*- C++ -*-
// Copyright (C) 2001, 2003 Free Software Foundation, Inc.
// Copyright (C) 2001, 2003, 2004 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
......@@ -78,7 +78,7 @@
{
if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
{
_S_destroy_c_locale(this->_M_c_locale_messages);
_S_create_c_locale(this->_M_c_locale_messages, __s);
this->_S_destroy_c_locale(this->_M_c_locale_messages);
this->_S_create_c_locale(this->_M_c_locale_messages, __s);
}
}
// std::ctype implementation details, GNU version -*- C++ -*-
// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
// Copyright (C) 2001, 2002, 2003, 2004 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
......@@ -46,11 +46,11 @@ namespace std
{
if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
{
_S_destroy_c_locale(_M_c_locale_ctype);
_S_create_c_locale(_M_c_locale_ctype, __s);
_M_toupper = _M_c_locale_ctype->__ctype_toupper;
_M_tolower = _M_c_locale_ctype->__ctype_tolower;
_M_table = _M_c_locale_ctype->__ctype_b;
this->_S_destroy_c_locale(this->_M_c_locale_ctype);
this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
this->_M_table = this->_M_c_locale_ctype->__ctype_b;
}
}
......
// std::messages implementation details, GNU version -*- C++ -*-
// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
// Copyright (C) 2001, 2002, 2003, 2004 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
......@@ -108,7 +108,7 @@
#endif
if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
{
_S_destroy_c_locale(this->_M_c_locale_messages);
_S_create_c_locale(this->_M_c_locale_messages, __s);
this->_S_destroy_c_locale(this->_M_c_locale_messages);
this->_S_create_c_locale(this->_M_c_locale_messages, __s);
}
}
......@@ -36,6 +36,12 @@ inline void __function_requires()
void (_Concept::*__x)() _IsUnused = &_Concept::__constraints;
}
// No definition: if this is referenced, there's a problem with
// the instantiating type not being one of the required integer types.
// Unfortunately, this results in a link-time error, not a compile-time error.
void __error_type_must_be_an_integer_type();
void __error_type_must_be_an_unsigned_integer_type();
void __error_type_must_be_a_signed_integer_type();
// ??? Should the "concept_checking*" structs begin with more than _ ?
#define _GLIBCXX_CLASS_REQUIRES(_type_var, _ns, _concept) \
......@@ -88,7 +94,7 @@ struct _Aux_require_same<_Tp,_Tp> { typedef _Tp _Type; };
template <class _Tp>
struct _IntegerConcept {
void __constraints() {
this->__error_type_must_be_an_integer_type();
__error_type_must_be_an_integer_type();
}
};
template <> struct _IntegerConcept<short> { void __constraints() {} };
......@@ -104,7 +110,7 @@ struct _Aux_require_same<_Tp,_Tp> { typedef _Tp _Type; };
template <class _Tp>
struct _SignedIntegerConcept {
void __constraints() {
this->__error_type_must_be_a_signed_integer_type();
__error_type_must_be_a_signed_integer_type();
}
};
template <> struct _SignedIntegerConcept<short> { void __constraints() {} };
......@@ -115,7 +121,7 @@ struct _Aux_require_same<_Tp,_Tp> { typedef _Tp _Type; };
template <class _Tp>
struct _UnsignedIntegerConcept {
void __constraints() {
this->__error_type_must_be_an_unsigned_integer_type();
__error_type_must_be_an_unsigned_integer_type();
}
};
template <> struct _UnsignedIntegerConcept<unsigned short>
......
......@@ -459,8 +459,8 @@
{
if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
{
_S_destroy_c_locale(this->_M_c_locale_codecvt);
_S_create_c_locale(this->_M_c_locale_codecvt, __s);
this->_S_destroy_c_locale(this->_M_c_locale_codecvt);
this->_S_create_c_locale(this->_M_c_locale_codecvt, __s);
}
}
......
......@@ -234,7 +234,7 @@ class _Rope_char_consumer {
// First a lot of forward declarations. The standard seems to require
// much stricter "declaration before use" than many of the implementations
// that preceded it.
template<class _CharT, class _Alloc=allocator<_CharT> > class rope;
template<class _CharT, class _Alloc = allocator<_CharT> > class rope;
template<class _CharT, class _Alloc> struct _Rope_RopeConcatenation;
template<class _CharT, class _Alloc> struct _Rope_RopeLeaf;
template<class _CharT, class _Alloc> struct _Rope_RopeFunction;
......@@ -459,6 +459,11 @@ struct _Rope_rep_base
# undef __ROPE_DEFINE_ALLOC
};
namespace _Rope_constants
{
enum { _S_max_rope_depth = 45 };
enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function};
}
template<class _CharT, class _Alloc>
struct _Rope_RopeRep : public _Rope_rep_base<_CharT,_Alloc>
......@@ -467,9 +472,7 @@ struct _Rope_RopeRep : public _Rope_rep_base<_CharT,_Alloc>
# endif
{
public:
enum { _S_max_rope_depth = 45 };
enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function};
_Tag _M_tag:8;
_Rope_constants::_Tag _M_tag:8;
bool _M_is_balanced:8;
unsigned char _M_depth;
__GC_CONST _CharT* _M_c_string;
......@@ -483,7 +486,7 @@ struct _Rope_RopeRep : public _Rope_rep_base<_CharT,_Alloc>
typedef typename _Rope_rep_base<_CharT,_Alloc>::allocator_type
allocator_type;
using _Rope_rep_base<_CharT,_Alloc>::get_allocator;
_Rope_RopeRep(_Tag __t, int __d, bool __b, size_t __size,
_Rope_RopeRep(_Rope_constants::_Tag __t, int __d, bool __b, size_t __size,
allocator_type __a)
: _Rope_rep_base<_CharT,_Alloc>(__size, __a),
# ifndef __GC
......@@ -579,9 +582,7 @@ struct _Rope_RopeLeaf : public _Rope_RopeRep<_CharT,_Alloc> {
typedef typename _Rope_rep_base<_CharT,_Alloc>::allocator_type
allocator_type;
_Rope_RopeLeaf(__GC_CONST _CharT* __d, size_t __size, allocator_type __a)
: _Rope_RopeRep<_CharT,_Alloc>(_Rope_RopeRep<_CharT,_Alloc>::_S_leaf,
0, true, __size, __a),
_M_data(__d)
: _Rope_RopeRep<_CharT,_Alloc>(_Rope_constants::_S_leaf, 0, true, __size, __a), _M_data(__d)
{
if (_S_is_basic_char_type((_CharT *)0)) {
// already eos terminated.
......@@ -612,7 +613,7 @@ struct _Rope_RopeConcatenation : public _Rope_RopeRep<_CharT,_Alloc> {
_Rope_RopeRep<_CharT,_Alloc>* __r,
allocator_type __a)
: _Rope_RopeRep<_CharT,_Alloc>(_Rope_RopeRep<_CharT,_Alloc>::_S_concat,
: _Rope_RopeRep<_CharT,_Alloc>(_Rope_constants::_S_concat,
std::max(__l->_M_depth, __r->_M_depth) + 1,
false,
__l->_M_size + __r->_M_size, __a),
......@@ -650,7 +651,7 @@ struct _Rope_RopeFunction : public _Rope_RopeRep<_CharT,_Alloc> {
allocator_type;
_Rope_RopeFunction(char_producer<_CharT>* __f, size_t __size,
bool __d, allocator_type __a)
: _Rope_RopeRep<_CharT,_Alloc>(_Rope_RopeRep<_CharT,_Alloc>::_S_function,
: _Rope_RopeRep<_CharT,_Alloc>(_Rope_constants::_S_function,
0, true, __size, __a)
, _M_fn(__f)
# ifndef __GC
......@@ -690,15 +691,15 @@ struct _Rope_RopeSubstring : public _Rope_RopeFunction<_CharT,_Alloc>,
virtual void operator()(size_t __start_pos, size_t __req_len,
_CharT* __buffer) {
switch(_M_base->_M_tag) {
case _Rope_RopeFunction<_CharT,_Alloc>::_S_function:
case _Rope_RopeFunction<_CharT,_Alloc>::_S_substringfn:
case _Rope_constants::_S_function:
case _Rope_constants::_S_substringfn:
{
char_producer<_CharT>* __fn =
((_Rope_RopeFunction<_CharT,_Alloc>*)_M_base)->_M_fn;
(*__fn)(__start_pos + _M_start, __req_len, __buffer);
}
break;
case _Rope_RopeFunction<_CharT,_Alloc>::_S_leaf:
case _Rope_constants::_S_leaf:
{
__GC_CONST _CharT* __s =
((_Rope_RopeLeaf<_CharT,_Alloc>*)_M_base)->_M_data;
......@@ -722,7 +723,7 @@ struct _Rope_RopeSubstring : public _Rope_RopeFunction<_CharT,_Alloc>,
# ifndef __GC
_M_base->_M_ref_nonnil();
# endif
this->_M_tag = _Rope_RopeFunction<_CharT,_Alloc>::_S_substringfn;
this->_M_tag = _Rope_constants::_S_substringfn;
}
virtual ~_Rope_RopeSubstring()
{
......@@ -1426,7 +1427,7 @@ class rope : public _Rope_base<_CharT,_Alloc> {
_CharT* __buffer);
static const unsigned long
_S_min_len[_RopeRep::_S_max_rope_depth + 1];
_S_min_len[_Rope_constants::_S_max_rope_depth + 1];
static bool _S_is_balanced(_RopeRep* __r)
{ return (__r->_M_size >= _S_min_len[__r->_M_depth]); }
......@@ -1511,7 +1512,7 @@ class rope : public _Rope_base<_CharT,_Alloc> {
rope(_CharT __c, const allocator_type& __a = allocator_type())
: _Base(__a)
{
_CharT* __buf = _Data_allocate(_S_rounded_up_size(1));
_CharT* __buf = __a.allocate(_S_rounded_up_size(1));
std::_Construct(__buf, __c);
try {
......@@ -1664,7 +1665,7 @@ class rope : public _Rope_base<_CharT,_Alloc> {
// is safe for multiple threads.
void delete_c_str () {
if (0 == this->_M_tree_ptr) return;
if (_RopeRep::_S_leaf == this->_M_tree_ptr->_M_tag &&
if (_Rope_constants::_S_leaf == this->_M_tree_ptr->_M_tag &&
((_RopeLeaf*)this->_M_tree_ptr)->_M_data ==
this->_M_tree_ptr->_M_c_string) {
// Representation shared
......@@ -1711,7 +1712,7 @@ class rope : public _Rope_base<_CharT,_Alloc> {
}
size_type max_size() const {
return _S_min_len[_RopeRep::_S_max_rope_depth-1] - 1;
return _S_min_len[_Rope_constants::_S_max_rope_depth - 1] - 1;
// Guarantees that the result can be sufficirntly
// balanced. Longer ropes will probably still work,
// but it's harder to make guarantees.
......
......@@ -30,6 +30,7 @@
#include "new"
// We can't rely on having stdlib.h if we're freestanding.
extern "C" void free (void *);
void
......
// -*- C++ -*- Allocate exception objects.
// Copyright (C) 2001 Free Software Foundation, Inc.
// Copyright (C) 2001, 2004 Free Software Foundation, Inc.
//
// This file is part of GCC.
//
......@@ -94,7 +94,7 @@ emergency_mutex_init ()
extern "C" void *
__cxa_allocate_exception(std::size_t thrown_size)
__cxa_allocate_exception(std::size_t thrown_size) throw()
{
void *ret;
......@@ -141,7 +141,7 @@ __cxa_allocate_exception(std::size_t thrown_size)
extern "C" void
__cxa_free_exception(void *vptr)
__cxa_free_exception(void *vptr) throw()
{
char *ptr = (char *) vptr;
if (ptr >= &emergency_buffer[0][0]
......
......@@ -34,7 +34,6 @@
#include "unwind-cxx.h"
#include "exception_defines.h"
extern "C" void
__cxa_bad_cast ()
{
......
......@@ -35,7 +35,7 @@ using namespace __cxxabiv1;
extern "C" void *
__cxa_begin_catch (void *exc_obj_in)
__cxa_begin_catch (void *exc_obj_in) throw()
{
_Unwind_Exception *exceptionObject
= reinterpret_cast <_Unwind_Exception *>(exc_obj_in);
......
// -*- C++ -*- Manage the thread-local exception globals.
// Copyright (C) 2001 Free Software Foundation, Inc.
// Copyright (C) 2001, 2004 Free Software Foundation, Inc.
//
// This file is part of GCC.
//
......@@ -69,7 +69,7 @@ get_globals_init_once ()
#endif
extern "C" __cxa_eh_globals *
__cxa_get_globals_fast ()
__cxa_get_globals_fast () throw()
{
#if __GTHREADS
if (use_thread_key)
......@@ -82,7 +82,7 @@ __cxa_get_globals_fast ()
}
extern "C" __cxa_eh_globals *
__cxa_get_globals ()
__cxa_get_globals () throw()
{
#if __GTHREADS
__cxa_eh_globals *g;
......
// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
// Copyright (C) 2000, 2002, 2004 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
......@@ -85,8 +85,7 @@ namespace std
codecvt<char, char, mbstate_t>::
do_in(state_type&, const extern_type* __from,
const extern_type*, const extern_type*& __from_next,
intern_type* __to, intern_type*,
intern_type*& __to_next) const
intern_type* __to, intern_type*, intern_type*& __to_next) const
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// According to the resolution of DR19, "If returns noconv [...]
......@@ -110,7 +109,10 @@ namespace std
codecvt<char, char, mbstate_t>::
do_length (state_type&, const extern_type* __from,
const extern_type* __end, size_t __max) const
{ return std::min(__max, static_cast<size_t>(__end - __from)); }
{
size_t __d = static_cast<size_t>(__end - __from);
return std::min(__max, __d);
}
int
codecvt<char, char, mbstate_t>::
......
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
......@@ -108,9 +108,9 @@ namespace std
{
if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
{
_S_destroy_c_locale(_M_c_locale_ctype);
_S_create_c_locale(_M_c_locale_ctype, __s);
_M_initialize_ctype();
this->_S_destroy_c_locale(this->_M_c_locale_ctype);
this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
this->_M_initialize_ctype();
}
}
#endif
......
// Explicit instantiation file.
// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
// Copyright (C) 2001, 2002, 2004 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
......@@ -34,11 +34,18 @@
#include <ext/rope>
#include <ext/stdio_filebuf.h>
namespace __gnu_internal
{
const int min_len = __gnu_cxx::_Rope_constants::_S_max_rope_depth + 1;
}
namespace __gnu_cxx
{
using namespace __gnu_internal;
template
const unsigned long
rope<char, std::allocator<char> >::_S_min_len;
rope<char, std::allocator<char> >::_S_min_len[min_len];
template
char
......@@ -50,7 +57,7 @@ namespace __gnu_cxx
#ifdef _GLIBCXX_USE_WCHAR_T
template
const unsigned long
rope<wchar_t, std::allocator<wchar_t> >::_S_min_len;
rope<wchar_t, std::allocator<wchar_t> >::_S_min_len[min_len];
template
wchar_t
......
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