Added new config macros:

BOOST_HAS_PARTIAL_STD_ALLOCATOR
	BOOST_NO_EXCEPTION_STD_NAMESPACE


[SVN r14809]
This commit is contained in:
John Maddock
2002-08-13 11:52:06 +00:00
parent 9a536e3f28
commit 3dfd72e3bc
12 changed files with 278 additions and 1 deletions

View File

@ -554,6 +554,12 @@ struct foo : {
class X { ... };</pre>
</td>
</tr>
<tr>
<td valign="top">BOOST_NO_EXCEPTION_STD_NAMESPACE</td>
<td valign="top">Standard Library</td>
<td>The standard library does not put some or all of the
contents of &lt;exception&gt; in namespace std.</td>
</tr>
<tr>
<td valign="top">BOOST_NO_EXCEPTIONS</td>
<td valign="top">Compiler</td>
@ -894,6 +900,12 @@ present.</p>
<td valign="top" width="37%">The platform has an
&lt;nl_types.h&gt;.</td>
</tr>
<tr>
<td valign="top">BOOST_HAS_PARTIAL_STD_ALLOCATOR</td>
<td>Standard Library</td>
<td>The standard library has a partially conforming std::allocator
class, but without any of the member templates.</td>
</tr>
<tr>
<td>BOOST_HAS_PTHREAD_DELAY_NP</td>
<td>Platform</td>

View File

@ -30,6 +30,8 @@
# define BOOST_HAS_TWO_ARG_USE_FACET
// C lib functions aren't in namespace std either:
# define BOOST_NO_STDC_NAMESPACE
// and nor is <exception>
# define BOOST_NO_EXCEPTION_STD_NAMESPACE
# endif
// 3.06 appears to have (non-sgi versions of) <hash_set> & <hash_map>,
// and no <slist> at all

View File

@ -64,6 +64,10 @@
# define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
# define BOOST_NO_STD_ALLOCATOR
#endif
//
// however we always have at least a partial allocator:
//
#define BOOST_HAS_PARTIAL_STD_ALLOCATOR
#if !defined(_STLP_MEMBER_TEMPLATE_CLASSES)
# define BOOST_NO_STD_ALLOCATOR
@ -99,6 +103,7 @@
|| defined(_STLP_USE_OWN_NAMESPACE)) \
&& (defined(__STL_VENDOR_GLOBAL_CSTD) || defined (_STLP_VENDOR_GLOBAL_CSTD))
# define BOOST_NO_STDC_NAMESPACE
# define BOOST_NO_EXCEPTION_STD_NAMESPACE
# endif
#elif __BORLANDC__ < 0x560
// STLport doesn't import std::abs correctly:

View File

@ -132,6 +132,13 @@
# define BOOST_NO_STD_ALLOCATOR
# endif
//
// If we have a standard allocator, then we have a partial one as well:
//
#if !defined(BOOST_NO_STD_ALLOCATOR)
# define BOOST_HAS_PARTIAL_STD_ALLOCATOR
#endif
//
// We can't have a working std::use_facet if there is no std::locale:
//

View File

@ -0,0 +1,59 @@
// (C) Copyright John Maddock 2001. Permission to copy, use, modify, sell and
// distribute this software is granted provided this copyright notice appears
// in all copies. This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// MACRO: BOOST_HAS_PARTIAL_STD_ALLOCATOR
// TITLE: limited std::allocator support
// DESCRIPTION: The std lib has at least some kind of stanfard allocator
// with allocate/deallocate members and probably not much more.
#include <memory>
namespace boost_has_partial_std_allocator{
//
// test everything except rebind template members:
//
template <class T>
int test_allocator(const T& i)
{
typedef std::allocator<int> alloc1_t;
typedef typename alloc1_t::size_type size_type;
typedef typename alloc1_t::difference_type difference_type;
typedef typename alloc1_t::pointer pointer;
typedef typename alloc1_t::const_pointer const_pointer;
typedef typename alloc1_t::reference reference;
typedef typename alloc1_t::const_reference const_reference;
typedef typename alloc1_t::value_type value_type;
alloc1_t a1;
pointer p = a1.allocate(1);
const_pointer cp = p;
a1.construct(p,i);
size_type s = a1.max_size();
(void)s;
reference r = *p;
const_reference cr = *cp;
if(p != a1.address(r)) return -1;
if(cp != a1.address(cr)) return -1;
a1.destroy(p);
a1.deallocate(p,1);
return 0;
}
int test()
{
return test_allocator(0);
}
}

View File

@ -0,0 +1,32 @@
// (C) Copyright John Maddock 2001. Permission to copy, use, modify, sell and
// distribute this software is granted provided this copyright notice appears
// in all copies. This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// MACRO: BOOST_NO_EXCEPTION_STD_NAMESPACE
// TITLE: <exception> is in namespace std
// DESCRIPTION: Some std libs don't put the contents of
// <exception> in namespace std.
#include <exception>
namespace boost_no_exception_std_namespace{
int t(int i)
{
if(i)
std::terminate();
return 0;
}
int test()
{
return t(0);
}
}

View File

@ -10,7 +10,7 @@
// Do not edit this file, it was generated automatically by
// ../tools/generate from boost_*.cxx on
// Thu Jul 18 11:26:48 2002
// Tue Aug 13 12:19:31 2002
#include <boost/config.hpp>
#define BOOST_INCLUDE_MAIN
@ -67,6 +67,11 @@ namespace boost_no_dependent_nested_derivations = empty_boost;
#else
namespace boost_no_dependent_types_in_template_value_parameters = empty_boost;
#endif
#ifndef BOOST_NO_EXCEPTION_STD_NAMESPACE
#include "boost_no_excep_std.cxx"
#else
namespace boost_no_exception_std_namespace = empty_boost;
#endif
#ifndef BOOST_NO_EXCEPTIONS
#include "boost_no_exceptions.cxx"
#else
@ -307,6 +312,11 @@ namespace boost_has_nanosleep = empty_boost;
#else
namespace boost_has_nl_types_h = empty_boost;
#endif
#ifdef BOOST_HAS_PARTIAL_STD_ALLOCATOR
#include "boost_has_part_alloc.cxx"
#else
namespace boost_has_partial_std_allocator = empty_boost;
#endif
#ifdef BOOST_HAS_PTHREAD_DELAY_NP
#include "boost_has_pthread_delay_np.cxx"
#else
@ -411,6 +421,7 @@ int test_main( int, char *[] )
BOOST_TEST(0 == boost_no_function_template_ordering::test());
BOOST_TEST(0 == boost_no_explicit_function_template_arguments::test());
BOOST_TEST(0 == boost_no_exceptions::test());
BOOST_TEST(0 == boost_no_exception_std_namespace::test());
BOOST_TEST(0 == boost_no_dependent_types_in_template_value_parameters::test());
BOOST_TEST(0 == boost_no_dependent_nested_derivations::test());
BOOST_TEST(0 == boost_no_cwctype::test());
@ -434,6 +445,7 @@ int test_main( int, char *[] )
BOOST_TEST(0 == boost_has_pthread_yield::test());
BOOST_TEST(0 == boost_has_pthread_mutexattr_settype::test());
BOOST_TEST(0 == boost_has_pthread_delay_np::test());
BOOST_TEST(0 == boost_has_partial_std_allocator::test());
BOOST_TEST(0 == boost_has_nl_types_h::test());
BOOST_TEST(0 == boost_has_nanosleep::test());
BOOST_TEST(0 == boost_has_ms_int64::test());

View File

@ -0,0 +1,36 @@
// (C) Copyright Boost.org 1999. Permission to copy, use, modify, sell and
// distribute this software is granted provided this copyright notice appears
// in all copies. This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// Test file for macro BOOST_HAS_PARTIAL_STD_ALLOCATOR
// This file should not compile, if it does then
// BOOST_HAS_PARTIAL_STD_ALLOCATOR may be defined.
// see boost_has_part_alloc.cxx for more details
// Do not edit this file, it was generated automatically by
// ../tools/generate from boost_has_part_alloc.cxx on
// Tue Aug 13 12:19:31 2002
// Must not have BOOST_ASSERT_CONFIG set; it defeats
// the objective of this file:
#ifdef BOOST_ASSERT_CONFIG
# undef BOOST_ASSERT_CONFIG
#endif
#include <boost/config.hpp>
#include <boost/test/cpp_main.cpp>
#include "test.hpp"
#ifndef BOOST_HAS_PARTIAL_STD_ALLOCATOR
#include "boost_has_part_alloc.cxx"
#else
#error "this file should not compile"
#endif
int cpp_main( int, char *[] )
{
return boost_has_partial_std_allocator::test();
}

View File

@ -0,0 +1,36 @@
// (C) Copyright Boost.org 1999. Permission to copy, use, modify, sell and
// distribute this software is granted provided this copyright notice appears
// in all copies. This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// Test file for macro BOOST_HAS_PARTIAL_STD_ALLOCATOR
// This file should compile, if it does not then
// BOOST_HAS_PARTIAL_STD_ALLOCATOR should not be defined.
// see boost_has_part_alloc.cxx for more details
// Do not edit this file, it was generated automatically by
// ../tools/generate from boost_has_part_alloc.cxx on
// Tue Aug 13 12:19:31 2002
// Must not have BOOST_ASSERT_CONFIG set; it defeats
// the objective of this file:
#ifdef BOOST_ASSERT_CONFIG
# undef BOOST_ASSERT_CONFIG
#endif
#include <boost/config.hpp>
#include <boost/test/cpp_main.cpp>
#include "test.hpp"
#ifdef BOOST_HAS_PARTIAL_STD_ALLOCATOR
#include "boost_has_part_alloc.cxx"
#else
namespace boost_has_partial_std_allocator = empty_boost;
#endif
int cpp_main( int, char *[] )
{
return boost_has_partial_std_allocator::test();
}

View File

@ -0,0 +1,36 @@
// (C) Copyright Boost.org 1999. Permission to copy, use, modify, sell and
// distribute this software is granted provided this copyright notice appears
// in all copies. This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// Test file for macro BOOST_NO_EXCEPTION_STD_NAMESPACE
// This file should not compile, if it does then
// BOOST_NO_EXCEPTION_STD_NAMESPACE need not be defined.
// see boost_no_excep_std.cxx for more details
// Do not edit this file, it was generated automatically by
// ../tools/generate from boost_no_excep_std.cxx on
// Tue Aug 13 12:19:31 2002
// Must not have BOOST_ASSERT_CONFIG set; it defeats
// the objective of this file:
#ifdef BOOST_ASSERT_CONFIG
# undef BOOST_ASSERT_CONFIG
#endif
#include <boost/config.hpp>
#include <boost/test/cpp_main.cpp>
#include "test.hpp"
#ifdef BOOST_NO_EXCEPTION_STD_NAMESPACE
#include "boost_no_excep_std.cxx"
#else
#error "this file should not compile"
#endif
int cpp_main( int, char *[] )
{
return boost_no_exception_std_namespace::test();
}

View File

@ -0,0 +1,36 @@
// (C) Copyright Boost.org 1999. Permission to copy, use, modify, sell and
// distribute this software is granted provided this copyright notice appears
// in all copies. This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
// Test file for macro BOOST_NO_EXCEPTION_STD_NAMESPACE
// This file should compile, if it does not then
// BOOST_NO_EXCEPTION_STD_NAMESPACE needs to be defined.
// see boost_no_excep_std.cxx for more details
// Do not edit this file, it was generated automatically by
// ../tools/generate from boost_no_excep_std.cxx on
// Tue Aug 13 12:19:31 2002
// Must not have BOOST_ASSERT_CONFIG set; it defeats
// the objective of this file:
#ifdef BOOST_ASSERT_CONFIG
# undef BOOST_ASSERT_CONFIG
#endif
#include <boost/config.hpp>
#include <boost/test/cpp_main.cpp>
#include "test.hpp"
#ifndef BOOST_NO_EXCEPTION_STD_NAMESPACE
#include "boost_no_excep_std.cxx"
#else
namespace boost_no_exception_std_namespace = empty_boost;
#endif
int cpp_main( int, char *[] )
{
return boost_no_exception_std_namespace::test();
}

View File

@ -25,6 +25,8 @@ run libs/config/test/no_dep_nested_class_pass.cpp
link-fail libs/config/test/no_dep_nested_class_fail.cpp
run libs/config/test/no_dep_val_param_pass.cpp
link-fail libs/config/test/no_dep_val_param_fail.cpp
run libs/config/test/no_excep_std_pass.cpp
link-fail libs/config/test/no_excep_std_fail.cpp
run libs/config/test/no_exceptions_pass.cpp
link-fail libs/config/test/no_exceptions_fail.cpp
run libs/config/test/no_exp_func_tem_arg_pass.cpp
@ -121,6 +123,8 @@ run libs/config/test/has_nanosleep_pass.cpp
link-fail libs/config/test/has_nanosleep_fail.cpp
run libs/config/test/has_nl_types_h_pass.cpp
link-fail libs/config/test/has_nl_types_h_fail.cpp
run libs/config/test/has_part_alloc_pass.cpp
link-fail libs/config/test/has_part_alloc_fail.cpp
run libs/config/test/has_pthread_delay_np_pass.cpp
link-fail libs/config/test/has_pthread_delay_np_fail.cpp
run libs/config/test/has_pthread_ma_st_pass.cpp