From 219c351cb495aed4a993234d0d51da9927736f1e Mon Sep 17 00:00:00 2001 From: Glen Fernandes Date: Wed, 17 May 2017 01:07:18 -0400 Subject: [PATCH] Add BOOST_NO_CXX11_POINTER_TRAITS --- checks/Jamfile.v2 | 3 +- checks/test_case.cpp | 7 +++- doc/macro_reference.qbk | 2 ++ include/boost/config/stdlib/dinkumware.hpp | 7 ++++ include/boost/config/stdlib/libcomo.hpp | 1 + include/boost/config/stdlib/libcpp.hpp | 2 ++ include/boost/config/stdlib/libstdcpp3.hpp | 1 + include/boost/config/stdlib/modena.hpp | 1 + include/boost/config/stdlib/msl.hpp | 1 + include/boost/config/stdlib/roguewave.hpp | 1 + include/boost/config/stdlib/sgi.hpp | 1 + include/boost/config/stdlib/stlport.hpp | 1 + include/boost/config/stdlib/vacpp.hpp | 1 + include/boost/config/stdlib/xlcpp_zos.hpp | 1 + test/all/Jamfile.v2 | 5 ++- test/boost_no_cxx11_pointer_traits.ipp | 37 ++++++++++++++++++++++ test/config_info.cpp | 2 ++ test/config_test.cpp | 12 ++++++- test/no_cxx11_pointer_traits_fail.cpp | 37 ++++++++++++++++++++++ test/no_cxx11_pointer_traits_pass.cpp | 37 ++++++++++++++++++++++ 20 files changed, 156 insertions(+), 4 deletions(-) create mode 100644 test/boost_no_cxx11_pointer_traits.ipp create mode 100644 test/no_cxx11_pointer_traits_fail.cpp create mode 100644 test/no_cxx11_pointer_traits_pass.cpp diff --git a/checks/Jamfile.v2 b/checks/Jamfile.v2 index adcd0c02..a6842bfc 100644 --- a/checks/Jamfile.v2 +++ b/checks/Jamfile.v2 @@ -1,6 +1,6 @@ # # *** DO NOT EDIT THIS FILE BY HAND *** -# This file was automatically generated on Mon Apr 17 18:35:54 2017 +# This file was automatically generated on Wed May 17 01:29:40 2017 # by libs/config/tools/generate.cpp # Copyright John Maddock. # Use, modification and distribution are subject to the @@ -107,6 +107,7 @@ obj cxx11_hdr_unordered_set : test_case.cpp : TEST_BOOST_NO_CXX11_HDR_UN obj cxx11_inline_namespaces : test_case.cpp : TEST_BOOST_NO_CXX11_INLINE_NAMESPACES ; obj cxx11_non_public_defaulted_functions : test_case.cpp : TEST_BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS ; obj cxx11_numeric_limits : test_case.cpp : TEST_BOOST_NO_CXX11_NUMERIC_LIMITS ; +obj cxx11_pointer_traits : test_case.cpp : TEST_BOOST_NO_CXX11_POINTER_TRAITS ; obj cxx11_ref_qualifiers : test_case.cpp : TEST_BOOST_NO_CXX11_REF_QUALIFIERS ; obj cxx11_sfinae_expr : test_case.cpp : TEST_BOOST_NO_CXX11_SFINAE_EXPR ; obj cxx11_smart_ptr : test_case.cpp : TEST_BOOST_NO_CXX11_SMART_PTR ; diff --git a/checks/test_case.cpp b/checks/test_case.cpp index 6689d1d7..c44e06d3 100644 --- a/checks/test_case.cpp +++ b/checks/test_case.cpp @@ -1,4 +1,4 @@ -// This file was automatically generated on Mon Apr 17 18:35:54 2017 +// This file was automatically generated on Wed May 17 01:29:40 2017 // by libs/config/tools/generate.cpp // Copyright John Maddock 2002-4. // Use, modification and distribution are subject to the @@ -491,6 +491,11 @@ # error "Defect macro BOOST_NO_CXX11_NUMERIC_LIMITS is defined." # endif #endif +#ifdef TEST_BOOST_NO_CXX11_POINTER_TRAITS +# ifdef BOOST_NO_CXX11_POINTER_TRAITS +# error "Defect macro BOOST_NO_CXX11_POINTER_TRAITS is defined." +# endif +#endif #ifdef TEST_BOOST_NO_CXX11_REF_QUALIFIERS # ifdef BOOST_NO_CXX11_REF_QUALIFIERS # error "Defect macro BOOST_NO_CXX11_REF_QUALIFIERS is defined." diff --git a/doc/macro_reference.qbk b/doc/macro_reference.qbk index 6e981225..a0d51e89 100644 --- a/doc/macro_reference.qbk +++ b/doc/macro_reference.qbk @@ -680,6 +680,8 @@ compilers implementing an early draft of the C++11 standard (in particular, inco [[`BOOST_NO_CXX11_NUMERIC_LIMITS`][The standard library `` header does not support the C++11 version of `numeric_limits`. ]] +[[`BOOST_NO_CXX11_POINTER_TRAITS`][The standard library does not provide a +C++11 version of `std::pointer_traits` in .]] [[`BOOST_NO_CXX11_RANGE_BASED_FOR`][The compiler does not support range-based for statements. ]] diff --git a/include/boost/config/stdlib/dinkumware.hpp b/include/boost/config/stdlib/dinkumware.hpp index 86fa7fe6..1689f0b0 100644 --- a/include/boost/config/stdlib/dinkumware.hpp +++ b/include/boost/config/stdlib/dinkumware.hpp @@ -147,6 +147,13 @@ # define BOOST_NO_CXX11_STD_ALIGN #endif +// Before 650 std::pointer_traits has a broken rebind template +#if !defined(_CPPLIB_VER) || _CPPLIB_VER < 650 +# define BOOST_NO_CXX11_POINTER_TRAITS +#elif defined(BOOST_MSVC) && BOOST_MSVC < 1910 +# define BOOST_NO_CXX11_POINTER_TRAITS +#endif + #if defined(__has_include) #if !__has_include() # define BOOST_NO_CXX14_HDR_SHARED_MUTEX diff --git a/include/boost/config/stdlib/libcomo.hpp b/include/boost/config/stdlib/libcomo.hpp index e3fc627f..ce83f082 100644 --- a/include/boost/config/stdlib/libcomo.hpp +++ b/include/boost/config/stdlib/libcomo.hpp @@ -55,6 +55,7 @@ # define BOOST_NO_CXX11_HDR_UNORDERED_SET # define BOOST_NO_CXX11_NUMERIC_LIMITS # define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_POINTER_TRAITS # define BOOST_NO_CXX11_ATOMIC_SMART_PTR # define BOOST_NO_CXX11_SMART_PTR # define BOOST_NO_CXX11_HDR_FUNCTIONAL diff --git a/include/boost/config/stdlib/libcpp.hpp b/include/boost/config/stdlib/libcpp.hpp index 2eea9997..b3a2fd01 100644 --- a/include/boost/config/stdlib/libcpp.hpp +++ b/include/boost/config/stdlib/libcpp.hpp @@ -29,6 +29,7 @@ // aliases since members rebind_alloc and rebind_traits require it. #if defined(_LIBCPP_HAS_NO_TEMPLATE_ALIASES) # define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_POINTER_TRAITS #endif #if __cplusplus < 201103 @@ -53,6 +54,7 @@ # define BOOST_NO_CXX11_HDR_UNORDERED_SET # define BOOST_NO_CXX11_NUMERIC_LIMITS # define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_POINTER_TRAITS # define BOOST_NO_CXX11_SMART_PTR # define BOOST_NO_CXX11_HDR_FUNCTIONAL # define BOOST_NO_CXX11_STD_ALIGN diff --git a/include/boost/config/stdlib/libstdcpp3.hpp b/include/boost/config/stdlib/libstdcpp3.hpp index 14dca142..baa93172 100644 --- a/include/boost/config/stdlib/libstdcpp3.hpp +++ b/include/boost/config/stdlib/libstdcpp3.hpp @@ -231,6 +231,7 @@ extern "C" char *gets (char *__s); // so 4.7.0 is the first truly conforming one. # define BOOST_NO_CXX11_HDR_CHRONO # define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_POINTER_TRAITS #endif // C++0x features in GCC 4.8.0 and later // diff --git a/include/boost/config/stdlib/modena.hpp b/include/boost/config/stdlib/modena.hpp index fa4a8187..98bdc3fb 100644 --- a/include/boost/config/stdlib/modena.hpp +++ b/include/boost/config/stdlib/modena.hpp @@ -44,6 +44,7 @@ # define BOOST_NO_CXX11_HDR_UNORDERED_SET # define BOOST_NO_CXX11_NUMERIC_LIMITS # define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_POINTER_TRAITS # define BOOST_NO_CXX11_ATOMIC_SMART_PTR # define BOOST_NO_CXX11_SMART_PTR # define BOOST_NO_CXX11_HDR_FUNCTIONAL diff --git a/include/boost/config/stdlib/msl.hpp b/include/boost/config/stdlib/msl.hpp index 96c1b0d5..9606a9ae 100644 --- a/include/boost/config/stdlib/msl.hpp +++ b/include/boost/config/stdlib/msl.hpp @@ -68,6 +68,7 @@ # define BOOST_NO_CXX11_HDR_UNORDERED_SET # define BOOST_NO_CXX11_NUMERIC_LIMITS # define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_POINTER_TRAITS # define BOOST_NO_CXX11_ATOMIC_SMART_PTR # define BOOST_NO_CXX11_SMART_PTR # define BOOST_NO_CXX11_HDR_FUNCTIONAL diff --git a/include/boost/config/stdlib/roguewave.hpp b/include/boost/config/stdlib/roguewave.hpp index 437d38d9..380d0ff3 100644 --- a/include/boost/config/stdlib/roguewave.hpp +++ b/include/boost/config/stdlib/roguewave.hpp @@ -180,6 +180,7 @@ # define BOOST_NO_CXX11_HDR_UNORDERED_SET # define BOOST_NO_CXX11_NUMERIC_LIMITS # define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_POINTER_TRAITS # define BOOST_NO_CXX11_ATOMIC_SMART_PTR # define BOOST_NO_CXX11_SMART_PTR # define BOOST_NO_CXX11_HDR_FUNCTIONAL diff --git a/include/boost/config/stdlib/sgi.hpp b/include/boost/config/stdlib/sgi.hpp index 8d2f849f..5016ff62 100644 --- a/include/boost/config/stdlib/sgi.hpp +++ b/include/boost/config/stdlib/sgi.hpp @@ -138,6 +138,7 @@ # define BOOST_NO_CXX11_HDR_UNORDERED_SET # define BOOST_NO_CXX11_NUMERIC_LIMITS # define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_POINTER_TRAITS # define BOOST_NO_CXX11_ATOMIC_SMART_PTR # define BOOST_NO_CXX11_SMART_PTR # define BOOST_NO_CXX11_HDR_FUNCTIONAL diff --git a/include/boost/config/stdlib/stlport.hpp b/include/boost/config/stdlib/stlport.hpp index 518f9efd..81e6ccf0 100644 --- a/include/boost/config/stdlib/stlport.hpp +++ b/include/boost/config/stdlib/stlport.hpp @@ -228,6 +228,7 @@ namespace boost { using std::min; using std::max; } # define BOOST_NO_CXX11_HDR_UNORDERED_SET # define BOOST_NO_CXX11_NUMERIC_LIMITS # define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_POINTER_TRAITS # define BOOST_NO_CXX11_ATOMIC_SMART_PTR # define BOOST_NO_CXX11_SMART_PTR # define BOOST_NO_CXX11_HDR_FUNCTIONAL diff --git a/include/boost/config/stdlib/vacpp.hpp b/include/boost/config/stdlib/vacpp.hpp index f9afef63..c159af25 100644 --- a/include/boost/config/stdlib/vacpp.hpp +++ b/include/boost/config/stdlib/vacpp.hpp @@ -44,6 +44,7 @@ # define BOOST_NO_CXX11_HDR_UNORDERED_SET # define BOOST_NO_CXX11_NUMERIC_LIMITS # define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_POINTER_TRAITS # define BOOST_NO_CXX11_ATOMIC_SMART_PTR # define BOOST_NO_CXX11_SMART_PTR # define BOOST_NO_CXX11_HDR_FUNCTIONAL diff --git a/include/boost/config/stdlib/xlcpp_zos.hpp b/include/boost/config/stdlib/xlcpp_zos.hpp index 35cca6e9..dce40f50 100644 --- a/include/boost/config/stdlib/xlcpp_zos.hpp +++ b/include/boost/config/stdlib/xlcpp_zos.hpp @@ -31,6 +31,7 @@ #define BOOST_NO_CXX11_ATOMIC_SMART_PTR #define BOOST_NO_CXX11_NUMERIC_LIMITS #define BOOST_NO_CXX11_ALLOCATOR +#define BOOST_NO_CXX11_POINTER_TRAITS #define BOOST_NO_CXX11_HDR_FUNCTIONAL #define BOOST_NO_CXX11_HDR_UNORDERED_SET #define BOOST_NO_CXX11_HDR_UNORDERED_MAP diff --git a/test/all/Jamfile.v2 b/test/all/Jamfile.v2 index f99040be..db1f5a1c 100644 --- a/test/all/Jamfile.v2 +++ b/test/all/Jamfile.v2 @@ -1,7 +1,7 @@ # # Regression test Jamfile for boost configuration setup. # *** DO NOT EDIT THIS FILE BY HAND *** -# This file was automatically generated on Mon Apr 17 18:35:54 2017 +# This file was automatically generated on Wed May 17 01:29:40 2017 # by libs/config/tools/generate.cpp # Copyright John Maddock. # Use, modification and distribution are subject to the @@ -310,6 +310,9 @@ test-suite "BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS" : test-suite "BOOST_NO_CXX11_NUMERIC_LIMITS" : [ run ../no_cxx11_numeric_limits_pass.cpp ] [ compile-fail ../no_cxx11_numeric_limits_fail.cpp ] ; +test-suite "BOOST_NO_CXX11_POINTER_TRAITS" : +[ run ../no_cxx11_pointer_traits_pass.cpp ] +[ compile-fail ../no_cxx11_pointer_traits_fail.cpp ] ; test-suite "BOOST_NO_CXX11_REF_QUALIFIERS" : [ run ../no_cxx11_ref_qualifiers_pass.cpp ] [ compile-fail ../no_cxx11_ref_qualifiers_fail.cpp ] ; diff --git a/test/boost_no_cxx11_pointer_traits.ipp b/test/boost_no_cxx11_pointer_traits.ipp new file mode 100644 index 00000000..d7223f32 --- /dev/null +++ b/test/boost_no_cxx11_pointer_traits.ipp @@ -0,0 +1,37 @@ +/* +Copyright 2017 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +// MACRO: BOOST_NO_CXX11_POINTER_TRAITS +// TITLE: C++11 lacks a correct std::pointer_traits +// DESCRIPTION: The standard library lacks a working std::pointer_traits. + +#include + +namespace boost_no_cxx11_pointer_traits { + +template +struct pointer { + template + using rebind = pointer; +}; + +template +struct result { }; + +template<> +struct result > { + static const int value = 0; +}; + +int test() +{ + return result >::rebind >::value; +} + +} /* boost_no_cxx11_pointer_traits */ diff --git a/test/config_info.cpp b/test/config_info.cpp index 7f401181..b467d5ab 100644 --- a/test/config_info.cpp +++ b/test/config_info.cpp @@ -1048,6 +1048,7 @@ void print_boost_macros() PRINT_MACRO(BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS); PRINT_MACRO(BOOST_NO_CXX11_NULLPTR); PRINT_MACRO(BOOST_NO_CXX11_NUMERIC_LIMITS); + PRINT_MACRO(BOOST_NO_CXX11_POINTER_TRAITS); PRINT_MACRO(BOOST_NO_CXX11_RANGE_BASED_FOR); PRINT_MACRO(BOOST_NO_CXX11_RAW_LITERALS); PRINT_MACRO(BOOST_NO_CXX11_REF_QUALIFIERS); @@ -1163,6 +1164,7 @@ void print_boost_macros() + // END GENERATED BLOCK diff --git a/test/config_test.cpp b/test/config_test.cpp index d94a438d..176902d1 100644 --- a/test/config_test.cpp +++ b/test/config_test.cpp @@ -1,4 +1,4 @@ -// This file was automatically generated on Mon Apr 17 18:35:54 2017 +// This file was automatically generated on Wed May 17 01:29:40 2017 // by libs/config/tools/generate.cpp // Copyright John Maddock 2002-4. // Use, modification and distribution are subject to the @@ -237,6 +237,11 @@ namespace boost_no_cxx11_non_public_defaulted_functions = empty_boost; #else namespace boost_no_cxx11_numeric_limits = empty_boost; #endif +#ifndef BOOST_NO_CXX11_POINTER_TRAITS +#include "boost_no_cxx11_pointer_traits.ipp" +#else +namespace boost_no_cxx11_pointer_traits = empty_boost; +#endif #ifndef BOOST_NO_CXX11_REF_QUALIFIERS #include "boost_no_cxx11_ref_qualifiers.ipp" #else @@ -1521,6 +1526,11 @@ int main( int, char *[] ) std::cerr << "Failed test for BOOST_NO_CXX11_NUMERIC_LIMITS at: " << __FILE__ << ":" << __LINE__ << std::endl; ++error_count; } + if(0 != boost_no_cxx11_pointer_traits::test()) + { + std::cerr << "Failed test for BOOST_NO_CXX11_POINTER_TRAITS at: " << __FILE__ << ":" << __LINE__ << std::endl; + ++error_count; + } if(0 != boost_no_cxx11_ref_qualifiers::test()) { std::cerr << "Failed test for BOOST_NO_CXX11_REF_QUALIFIERS at: " << __FILE__ << ":" << __LINE__ << std::endl; diff --git a/test/no_cxx11_pointer_traits_fail.cpp b/test/no_cxx11_pointer_traits_fail.cpp new file mode 100644 index 00000000..59b881bb --- /dev/null +++ b/test/no_cxx11_pointer_traits_fail.cpp @@ -0,0 +1,37 @@ +// This file was automatically generated on Wed May 17 01:29:39 2017 +// by libs/config/tools/generate.cpp +// Copyright John Maddock 2002-4. +// Use, modification and distribution are subject to 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) + +// See http://www.boost.org/libs/config for the most recent version.// +// Revision $Id$ +// + + +// Test file for macro BOOST_NO_CXX11_POINTER_TRAITS +// This file should not compile, if it does then +// BOOST_NO_CXX11_POINTER_TRAITS should not be defined. +// See file boost_no_cxx11_pointer_traits.ipp for details + +// Must not have BOOST_ASSERT_CONFIG set; it defeats +// the objective of this file: +#ifdef BOOST_ASSERT_CONFIG +# undef BOOST_ASSERT_CONFIG +#endif + +#include +#include "test.hpp" + +#ifdef BOOST_NO_CXX11_POINTER_TRAITS +#include "boost_no_cxx11_pointer_traits.ipp" +#else +#error "this file should not compile" +#endif + +int main( int, char *[] ) +{ + return boost_no_cxx11_pointer_traits::test(); +} + diff --git a/test/no_cxx11_pointer_traits_pass.cpp b/test/no_cxx11_pointer_traits_pass.cpp new file mode 100644 index 00000000..071041b4 --- /dev/null +++ b/test/no_cxx11_pointer_traits_pass.cpp @@ -0,0 +1,37 @@ +// This file was automatically generated on Wed May 17 01:29:39 2017 +// by libs/config/tools/generate.cpp +// Copyright John Maddock 2002-4. +// Use, modification and distribution are subject to 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) + +// See http://www.boost.org/libs/config for the most recent version.// +// Revision $Id$ +// + + +// Test file for macro BOOST_NO_CXX11_POINTER_TRAITS +// This file should compile, if it does not then +// BOOST_NO_CXX11_POINTER_TRAITS should be defined. +// See file boost_no_cxx11_pointer_traits.ipp for details + +// Must not have BOOST_ASSERT_CONFIG set; it defeats +// the objective of this file: +#ifdef BOOST_ASSERT_CONFIG +# undef BOOST_ASSERT_CONFIG +#endif + +#include +#include "test.hpp" + +#ifndef BOOST_NO_CXX11_POINTER_TRAITS +#include "boost_no_cxx11_pointer_traits.ipp" +#else +namespace boost_no_cxx11_pointer_traits = empty_boost; +#endif + +int main( int, char *[] ) +{ + return boost_no_cxx11_pointer_traits::test(); +} +