Skip to content

Remove gcc 2_95 workaround. #101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/boost/format.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#endif

// *** Compatibility framework
#include <boost/format/detail/compat_workarounds.hpp>
#include <boost/format/detail/config_macros.hpp>

#ifdef BOOST_NO_LOCALE_ISDIGIT
#include <cctype> // we'll use the non-locale <cctype>'s std::isdigit(int)
Expand Down
18 changes: 9 additions & 9 deletions include/boost/format/alt_sstream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
#define BOOST_SK_ALT_SSTREAM_HPP

#include <string>
#include <ostream>
#include <streambuf>
#include <boost/core/allocator_access.hpp>
#include <boost/format/detail/compat_workarounds.hpp>
#include <boost/format/detail/config_macros.hpp>
#include <boost/utility/base_from_member.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/config.hpp>
Expand All @@ -40,14 +42,12 @@ namespace boost {
: public ::std::basic_streambuf<Ch, Tr>
{
typedef ::std::basic_streambuf<Ch, Tr> streambuf_t;
typedef typename CompatAlloc<Alloc>::compatible_type compat_allocator_type;
typedef typename CompatTraits<Tr>::compatible_type compat_traits_type;
public:
typedef Ch char_type;
typedef Tr traits_type;
typedef typename compat_traits_type::int_type int_type;
typedef typename compat_traits_type::pos_type pos_type;
typedef typename compat_traits_type::off_type off_type;
typedef typename Tr::int_type int_type;
typedef typename Tr::pos_type pos_type;
typedef typename Tr::off_type off_type;
typedef Alloc allocator_type;
typedef ::std::basic_string<Ch, Tr, Alloc> string_type;
typedef typename string_type::size_type size_type;
Expand Down Expand Up @@ -104,16 +104,16 @@ namespace boost {
::std::ios_base::openmode which
= ::std::ios_base::in | ::std::ios_base::out);
virtual int_type underflow();
virtual int_type pbackfail(int_type meta = compat_traits_type::eof());
virtual int_type overflow(int_type meta = compat_traits_type::eof());
virtual int_type pbackfail(int_type meta = Tr::eof());
virtual int_type overflow(int_type meta = Tr::eof());
void dealloc();
private:
enum { alloc_min = 256}; // minimum size of allocations

Ch *putend_; // remembers (over seeks) the highest value of pptr()
bool is_allocated_;
::std::ios_base::openmode mode_;
compat_allocator_type alloc_; // the allocator object
Alloc alloc_; // the allocator object
};


Expand Down
32 changes: 16 additions & 16 deletions include/boost/format/alt_sstream_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,19 +185,19 @@ namespace boost {
basic_altstringbuf<Ch, Tr, Alloc>::
underflow () {
if(gptr() == NULL) // no get area -> nothing to get.
return (compat_traits_type::eof());
return (Tr::eof());
else if(gptr() < egptr()) // ok, in buffer
return (compat_traits_type::to_int_type(*gptr()));
return (Tr::to_int_type(*gptr()));
else if(mode_ & ::std::ios_base::in && pptr() != NULL
&& (gptr() < pptr() || gptr() < putend_) )
{ // expand get area
if(putend_ < pptr())
putend_ = pptr(); // remember pptr reached this far
streambuf_t::setg(eback(), gptr(), putend_);
return (compat_traits_type::to_int_type(*gptr()));
return (Tr::to_int_type(*gptr()));
}
else // couldnt get anything. EOF.
return (compat_traits_type::eof());
return (Tr::eof());
}
// -end underflow(..)

Expand All @@ -208,16 +208,16 @@ namespace boost {
pbackfail (int_type meta) {
if(gptr() != NULL && (eback() < gptr())
&& (mode_ & (::std::ios_base::out)
|| compat_traits_type::eq_int_type(compat_traits_type::eof(), meta)
|| compat_traits_type::eq(compat_traits_type::to_char_type(meta), gptr()[-1]) ) ) {
|| Tr::eq_int_type(Tr::eof(), meta)
|| Tr::eq(Tr::to_char_type(meta), gptr()[-1]) ) ) {
streambuf_t::gbump(-1); // back one character
if(!compat_traits_type::eq_int_type(compat_traits_type::eof(), meta))
if(!Tr::eq_int_type(Tr::eof(), meta))
// put-back meta into get area
*gptr() = compat_traits_type::to_char_type(meta);
return (compat_traits_type::not_eof(meta));
*gptr() = Tr::to_char_type(meta);
return (Tr::not_eof(meta));
}
else
return (compat_traits_type::eof()); // failed putback
return (Tr::eof()); // failed putback
}
// -end pbackfail(..)

Expand All @@ -230,15 +230,15 @@ namespace boost {
#pragma warning(push)
#pragma warning(disable:4996)
#endif
if(compat_traits_type::eq_int_type(compat_traits_type::eof(), meta))
return compat_traits_type::not_eof(meta); // nothing to do
if(Tr::eq_int_type(Tr::eof(), meta))
return Tr::not_eof(meta); // nothing to do
else if(pptr() != NULL && pptr() < epptr()) {
streambuf_t::sputc(compat_traits_type::to_char_type(meta));
streambuf_t::sputc(Tr::to_char_type(meta));
return meta;
}
else if(! (mode_ & ::std::ios_base::out))
// no write position, and cant make one
return compat_traits_type::eof();
return Tr::eof();
else { // make a write position available
std::size_t prev_size = pptr() == NULL ? 0 : epptr() - eback();
std::size_t new_size = prev_size;
Expand All @@ -263,7 +263,7 @@ namespace boost {
}

if(0 < prev_size)
compat_traits_type::copy(newptr, oldptr, prev_size);
Tr::copy(newptr, oldptr, prev_size);
if(is_allocated_)
alloc_.deallocate(oldptr, prev_size);
is_allocated_=true;
Expand All @@ -287,7 +287,7 @@ namespace boost {
else
streambuf_t::setg(newptr, 0, newptr);
}
streambuf_t::sputc(compat_traits_type::to_char_type(meta));
streambuf_t::sputc(Tr::to_char_type(meta));
return meta;
}
#ifdef BOOST_MSVC
Expand Down
86 changes: 0 additions & 86 deletions include/boost/format/detail/compat_workarounds.hpp

This file was deleted.

5 changes: 1 addition & 4 deletions include/boost/format/detail/config_macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,12 @@

// make sure our local macros wont override something :
#if defined(BOOST_NO_LOCALE_ISDIGIT) || defined(BOOST_OVERLOAD_FOR_NON_CONST) \
|| defined(BOOST_IO_STD) || defined( BOOST_IO_NEEDS_USING_DECLARATION ) \
|| defined(BOOST_NO_TEMPLATE_STD_STREAM) \
|| defined(BOOST_FORMAT_STREAMBUF_DEFINED) || defined(BOOST_FORMAT_OSTREAM_DEFINED)
|| defined(BOOST_IO_STD) || defined( BOOST_IO_NEEDS_USING_DECLARATION )
#error "boost::format uses a local macro that is already defined."
#endif

// specific workarounds. each header can define BOOS_IO_STD if it
// needs. (e.g. because of IO_NEEDS_USING_DECLARATION)
#include <boost/format/detail/workarounds_gcc-2_95.hpp>
#include <boost/format/detail/workarounds_stlport.hpp>

#ifndef BOOST_IO_STD
Expand Down
9 changes: 0 additions & 9 deletions include/boost/format/detail/unset_macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,3 @@
#ifdef BOOST_IO_NEEDS_USING_DECLARATION
#undef BOOST_IO_NEEDS_USING_DECLARATION
#endif
#ifdef BOOST_NO_TEMPLATE_STD_STREAM
#undef BOOST_NO_TEMPLATE_STD_STREAM
#endif
#ifdef BOOST_FORMAT_STREAMBUF_DEFINED
#undef BOOST_FORMAT_STREAMBUF_DEFINED
#endif
#ifdef BOOST_FORMAT_OSTREAM_DEFINED
#undef BOOST_FORMAT_OSTREAM_DEFINED
#endif
Loading