Compare commits

..

1 Commits

Author SHA1 Message Date
5e54c37940 Branch at revision 46530
[SVN r46531]
2008-06-19 18:57:10 +00:00
10 changed files with 197 additions and 232 deletions

View File

@ -1,21 +0,0 @@
#----------------------------------------------------------------------------
# This file was automatically generated from the original CMakeLists.txt file
# Add a variable to hold the headers for the library
set (lib_headers
detail
)
# Add a library target to the build system
boost_library_project(
detail
# SRCDIRS
# TESTDIRS
HEADERS ${lib_headers}
# DOCDIRS
# DESCRIPTION "Helps Boost library developers adapt to compiler idiosyncrasies; not intended for library users."
MODULARIZED
# AUTHORS "John Maddock <john -at- johnmaddock.co.uk>"
# MAINTAINERS
)

View File

@ -1,4 +1,4 @@
/* Copyright 2003-2009 Joaquin M Lopez Munoz. /* Copyright 2003-2007 Joaqu<EFBFBD>n M L<EFBFBD>pez Mu<EFBFBD>oz.
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt) * http://www.boost.org/LICENSE_1_0.txt)
@ -178,31 +178,12 @@ void construct(void* p,const Type& t)
new (p) Type(t); new (p) Type(t);
} }
#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500))
/* MSVC++ issues spurious warnings about unreferencend formal parameters
* in destroy<Type> when Type is a class with trivial dtor.
*/
#pragma warning(push)
#pragma warning(disable:4100)
#endif
template<typename Type> template<typename Type>
void destroy(const Type* p) void destroy(const Type* p)
{ {
#if BOOST_WORKAROUND(__SUNPRO_CC,BOOST_TESTED_AT(0x590))
const_cast<Type*>(p)->~Type();
#else
p->~Type(); p->~Type();
#endif
} }
#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500))
#pragma warning(pop)
#endif
} /* namespace boost::detail::allocator */ } /* namespace boost::detail::allocator */
} /* namespace boost::detail */ } /* namespace boost::detail */

View File

@ -1,99 +0,0 @@
// Copyright 2005-2008 Daniel James.
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#if !defined(BOOST_DETAIL_CONTAINER_FWD_HPP)
#define BOOST_DETAIL_CONTAINER_FWD_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
#define BOOST_HASH_CHAR_TRAITS string_char_traits
#else
#define BOOST_HASH_CHAR_TRAITS char_traits
#endif
#if ((defined(__GLIBCPP__) || defined(__GLIBCXX__)) && defined(_GLIBCXX_DEBUG)) \
|| BOOST_WORKAROUND(__BORLANDC__, > 0x551) \
|| BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x842)) \
|| (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
#include <deque>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <complex>
#else
#include <cstddef>
#if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) && \
defined(__STL_CONFIG_H)
#define BOOST_CONTAINER_FWD_BAD_BITSET
#if !defined(__STL_NON_TYPE_TMPL_PARAM_BUG)
#define BOOST_CONTAINER_FWD_BAD_DEQUE
#endif
#endif
#if defined(BOOST_CONTAINER_FWD_BAD_DEQUE)
#include <deque>
#endif
#if defined(BOOST_CONTAINER_FWD_BAD_BITSET)
#include <bitset>
#endif
#if defined(BOOST_MSVC)
#pragma warning(push)
#pragma warning(disable:4099) // struct/class mismatch in fwd declarations
#endif
namespace std
{
template <class T> class allocator;
template <class charT, class traits, class Allocator> class basic_string;
template <class charT> struct BOOST_HASH_CHAR_TRAITS;
template <class T> class complex;
}
// gcc 3.4 and greater
namespace std
{
#if !defined(BOOST_CONTAINER_FWD_BAD_DEQUE)
template <class T, class Allocator> class deque;
#endif
template <class T, class Allocator> class list;
template <class T, class Allocator> class vector;
template <class Key, class T, class Compare, class Allocator> class map;
template <class Key, class T, class Compare, class Allocator>
class multimap;
template <class Key, class Compare, class Allocator> class set;
template <class Key, class Compare, class Allocator> class multiset;
#if !defined(BOOST_CONTAINER_FWD_BAD_BITSET)
template <size_t N> class bitset;
#endif
template <class T1, class T2> struct pair;
}
#if defined(BOOST_MSVC)
#pragma warning(pop)
#endif
#endif
#endif

View File

@ -61,7 +61,7 @@
|| defined(_M_ALPHA) || defined(__amd64) \ || defined(_M_ALPHA) || defined(__amd64) \
|| defined(__amd64__) || defined(_M_AMD64) \ || defined(__amd64__) || defined(_M_AMD64) \
|| defined(__x86_64) || defined(__x86_64__) \ || defined(__x86_64) || defined(__x86_64__) \
|| defined(_M_X64) || defined(__bfin__) || defined(_M_X64)
# define BOOST_LITTLE_ENDIAN # define BOOST_LITTLE_ENDIAN
# define BOOST_BYTE_ORDER 1234 # define BOOST_BYTE_ORDER 1234

View File

@ -10,15 +10,14 @@
// //
// boost/detail/lightweight_test.hpp - lightweight test library // boost/detail/lightweight_test.hpp - lightweight test library
// //
// Copyright (c) 2002, 2009 Peter Dimov // Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
// //
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0. (See
// See accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt // http://www.boost.org/LICENSE_1_0.txt)
// //
// BOOST_TEST(expression) // BOOST_TEST(expression)
// BOOST_ERROR(message) // BOOST_ERROR(message)
// BOOST_TEST_EQ(expr1, expr2)
// //
// int boost::report_errors() // int boost::report_errors()
// //
@ -50,27 +49,13 @@ inline void error_impl(char const * msg, char const * file, int line, char const
++test_errors(); ++test_errors();
} }
template<class T, class U> inline void test_eq_impl( char const * expr1, char const * expr2, char const * file, int line, char const * function, T const & t, U const & u )
{
if( t == u )
{
}
else
{
std::cerr << file << "(" << line << "): test '" << expr1 << " == " << expr2
<< "' failed in function '" << function << "': "
<< "'" << t << "' != '" << u << "'" << std::endl;
++test_errors();
}
}
} // namespace detail } // namespace detail
inline int report_errors() inline int report_errors()
{ {
int errors = detail::test_errors(); int errors = detail::test_errors();
if( errors == 0 ) if(errors == 0)
{ {
std::cerr << "No errors detected." << std::endl; std::cerr << "No errors detected." << std::endl;
return 0; return 0;
@ -86,6 +71,5 @@ inline int report_errors()
#define BOOST_TEST(expr) ((expr)? (void)0: ::boost::detail::test_failed_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION)) #define BOOST_TEST(expr) ((expr)? (void)0: ::boost::detail::test_failed_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION))
#define BOOST_ERROR(msg) ::boost::detail::error_impl(msg, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) #define BOOST_ERROR(msg) ::boost::detail::error_impl(msg, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION)
#define BOOST_TEST_EQ(expr1,expr2) ( ::boost::detail::test_eq_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED #endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED

View File

@ -13,11 +13,186 @@
// Copyright (c) 2003 David Abrahams // Copyright (c) 2003 David Abrahams
// Copyright (c) 2003 Peter Dimov // Copyright (c) 2003 Peter Dimov
// //
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0. (See
// See accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt // http://www.boost.org/LICENSE_1_0.txt)
// //
#include <boost/smart_ptr/detail/quick_allocator.hpp> #include <boost/config.hpp>
#include <boost/detail/lightweight_mutex.hpp>
#include <boost/type_traits/type_with_alignment.hpp>
#include <boost/type_traits/alignment_of.hpp>
#include <new> // ::operator new, ::operator delete
#include <cstddef> // std::size_t
namespace boost
{
namespace detail
{
template<unsigned size, unsigned align_> union freeblock
{
typedef typename boost::type_with_alignment<align_>::type aligner_type;
aligner_type aligner;
char bytes[size];
freeblock * next;
};
template<unsigned size, unsigned align_> struct allocator_impl
{
typedef freeblock<size, align_> block;
// It may seem odd to use such small pages.
//
// However, on a typical Windows implementation that uses
// the OS allocator, "normal size" pages interact with the
// "ordinary" operator new, slowing it down dramatically.
//
// 512 byte pages are handled by the small object allocator,
// and don't interfere with ::new.
//
// The other alternative is to use much bigger pages (1M.)
//
// It is surprisingly easy to hit pathological behavior by
// varying the page size. g++ 2.96 on Red Hat Linux 7.2,
// for example, passionately dislikes 496. 512 seems OK.
#if defined(BOOST_QA_PAGE_SIZE)
enum { items_per_page = BOOST_QA_PAGE_SIZE / size };
#else
enum { items_per_page = 512 / size }; // 1048560 / size
#endif
#ifdef BOOST_HAS_THREADS
static lightweight_mutex & mutex()
{
static lightweight_mutex m;
return m;
}
static lightweight_mutex * mutex_init;
#endif
static block * free;
static block * page;
static unsigned last;
static inline void * alloc()
{
#ifdef BOOST_HAS_THREADS
lightweight_mutex::scoped_lock lock( mutex() );
#endif
if(block * x = free)
{
free = x->next;
return x;
}
else
{
if(last == items_per_page)
{
// "Listen to me carefully: there is no memory leak"
// -- Scott Meyers, Eff C++ 2nd Ed Item 10
page = ::new block[items_per_page];
last = 0;
}
return &page[last++];
}
}
static inline void * alloc(std::size_t n)
{
if(n != size) // class-specific new called for a derived object
{
return ::operator new(n);
}
else
{
#ifdef BOOST_HAS_THREADS
lightweight_mutex::scoped_lock lock( mutex() );
#endif
if(block * x = free)
{
free = x->next;
return x;
}
else
{
if(last == items_per_page)
{
page = ::new block[items_per_page];
last = 0;
}
return &page[last++];
}
}
}
static inline void dealloc(void * pv)
{
if(pv != 0) // 18.4.1.1/13
{
#ifdef BOOST_HAS_THREADS
lightweight_mutex::scoped_lock lock( mutex() );
#endif
block * pb = static_cast<block *>(pv);
pb->next = free;
free = pb;
}
}
static inline void dealloc(void * pv, std::size_t n)
{
if(n != size) // class-specific delete called for a derived object
{
::operator delete(pv);
}
else if(pv != 0) // 18.4.1.1/13
{
#ifdef BOOST_HAS_THREADS
lightweight_mutex::scoped_lock lock( mutex() );
#endif
block * pb = static_cast<block *>(pv);
pb->next = free;
free = pb;
}
}
};
#ifdef BOOST_HAS_THREADS
template<unsigned size, unsigned align_>
lightweight_mutex * allocator_impl<size, align_>::mutex_init = &allocator_impl<size, align_>::mutex();
#endif
template<unsigned size, unsigned align_>
freeblock<size, align_> * allocator_impl<size, align_>::free = 0;
template<unsigned size, unsigned align_>
freeblock<size, align_> * allocator_impl<size, align_>::page = 0;
template<unsigned size, unsigned align_>
unsigned allocator_impl<size, align_>::last = allocator_impl<size, align_>::items_per_page;
template<class T>
struct quick_allocator: public allocator_impl< sizeof(T), boost::alignment_of<T>::value >
{
};
} // namespace detail
} // namespace boost
#endif // #ifndef BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED #endif // #ifndef BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED

View File

@ -1,56 +0,0 @@
// scoped_enum_emulation.hpp ---------------------------------------------------------//
// Copyright Beman Dawes, 2009
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Generates C++0x scoped enums if the feature is present, otherwise emulates C++0x
// scoped enums with C++03 namespaces and enums. The Boost.Config BOOST_NO_SCOPED_ENUMS
// macro is used to detect feature support.
//
// See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf for a
// description of the scoped enum feature. Note that the committee changed the name
// from strongly typed enum to scoped enum.
//
// Caution: only the syntax is emulated; the semantics are not emulated and
// the syntax emulation doesn't include being able to specify the underlying
// representation type.
//
// The emulation is via struct rather than namespace to allow use within classes.
// Thanks to Andrey Semashev for pointing that out.
//
// Helpful comments and suggestions were also made by Kjell Elster, Phil Endecott,
// Joel Falcou, Mathias Gaunard, Felipe Magno de Almeida, Matt Calabrese, Vincente
// Botet, and Daniel James.
//
// Sample usage:
//
// BOOST_SCOPED_ENUM_START(algae) { green, red, cyan }; BOOST_SCOPED_ENUM_END
// ...
// BOOST_SCOPED_ENUM(algae) sample( algae::red );
// void foo( BOOST_SCOPED_ENUM(algae) color );
// ...
// sample = algae::green;
// foo( algae::cyan );
#ifndef BOOST_SCOPED_ENUM_EMULATION_HPP
#define BOOST_SCOPED_ENUM_EMULATION_HPP
#include <boost/config.hpp>
#ifdef BOOST_NO_SCOPED_ENUMS
# define BOOST_SCOPED_ENUM_START(name) struct name { enum enum_t
# define BOOST_SCOPED_ENUM_END };
# define BOOST_SCOPED_ENUM(name) name::enum_t
#else
# define BOOST_SCOPED_ENUM_START(name) enum class name
# define BOOST_SCOPED_ENUM_END
# define BOOST_SCOPED_ENUM(name) name
#endif
#endif // BOOST_SCOPED_ENUM_EMULATION_HPP

View File

@ -79,17 +79,15 @@
// specialized on those types for this to work. // specialized on those types for this to work.
#include <locale> #include <locale>
#include <cwchar> // for mbstate_t #include <cwchar> // for mbstate_t
#include <cstddef> // for std::size_t #include <cstddef> // for std::size_t
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/detail/workaround.hpp> #include <boost/detail/workaround.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE) #if defined(BOOST_NO_STDC_NAMESPACE)
namespace std { using ::codecvt;
using ::mbstate_t; using ::mbstate_t;
using ::size_t;
}
#endif #endif
#if !defined(__MSL_CPP__) && !defined(__LIBCOMO__) #if !defined(__MSL_CPP__) && !defined(__LIBCOMO__)

View File

@ -1,16 +1,20 @@
// ----------------------------------------------------------- // -------------------------------------
// integer_log2.hpp // integer_log2.hpp
// //
// Gives the integer part of the logarithm, in base 2, of a // Gives the integer part of the logarithm, in base 2, of a
// given number. Behavior is undefined if the argument is <= 0. // given number. Behavior is undefined if the argument is <= 0.
// //
// Copyright (c) 2003-2004, 2008 Gennaro Prota //
// (C) Copyright Gennaro Prota 2003 - 2004.
// //
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
// //
// ----------------------------------------------------------- // ------------------------------------------------------
//
// $Id$
#ifndef BOOST_INTEGER_LOG2_HPP_GP_20030301 #ifndef BOOST_INTEGER_LOG2_HPP_GP_20030301
#define BOOST_INTEGER_LOG2_HPP_GP_20030301 #define BOOST_INTEGER_LOG2_HPP_GP_20030301
@ -33,7 +37,7 @@ namespace boost {
while (x != 1) { while (x != 1) {
const T t = static_cast<T>(x >> n); const T t = x >> n;
if (t) { if (t) {
result += n; result += n;
x = t; x = t;

View File

@ -1 +0,0 @@
boost_module(detail DEPENDS integer)