From 3ec5a2b573e8ea8175d786e1c10f91773d1fb473 Mon Sep 17 00:00:00 2001 From: akrzemi1 Date: Thu, 4 Jan 2018 00:58:32 +0100 Subject: [PATCH 1/3] Added macro BOOST_NO_CXX11_DEFAULTED_MOVES --- checks/Jamfile.v2 | 3 +- checks/test_case.cpp | 7 ++++- doc/macro_reference.qbk | 3 ++ include/boost/config/compiler/borland.hpp | 1 + include/boost/config/compiler/gcc.hpp | 1 + include/boost/config/compiler/visualc.hpp | 1 + include/boost/config/detail/suffix.hpp | 5 +++ test/all/Jamfile.v2 | 5 ++- test/boost_no_cxx11_defaulted_moves.ipp | 25 +++++++++++++++ test/config_info.cpp | 2 ++ test/config_test.cpp | 12 +++++++- test/no_cxx11_defaulted_moves_fail.cpp | 37 +++++++++++++++++++++++ test/no_cxx11_defaulted_moves_pass.cpp | 37 +++++++++++++++++++++++ 13 files changed, 135 insertions(+), 4 deletions(-) create mode 100644 test/boost_no_cxx11_defaulted_moves.ipp create mode 100644 test/no_cxx11_defaulted_moves_fail.cpp create mode 100644 test/no_cxx11_defaulted_moves_pass.cpp diff --git a/checks/Jamfile.v2 b/checks/Jamfile.v2 index 77b7e9d2..8ecfd756 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 Sun Jul 9 16:30:35 2017 +# This file was automatically generated on Wed Jan 03 23:31:31 2018 # by libs/config/tools/generate.cpp # Copyright John Maddock. # Use, modification and distribution are subject to the @@ -67,6 +67,7 @@ obj cxx11_addressof : test_case.cpp : TEST_BOOST_NO_CXX11_ADDRESSOF ; obj cxx11_alignas : test_case.cpp : TEST_BOOST_NO_CXX11_ALIGNAS ; obj cxx11_allocator : test_case.cpp : TEST_BOOST_NO_CXX11_ALLOCATOR ; obj cxx11_atomic_smart_ptr : test_case.cpp : TEST_BOOST_NO_CXX11_ATOMIC_SMART_PTR ; +obj cxx11_defaulted_moves : test_case.cpp : TEST_BOOST_NO_CXX11_DEFAULTED_MOVES ; obj cxx11_final : test_case.cpp : TEST_BOOST_NO_CXX11_FINAL ; obj cxx11_hdr_array : test_case.cpp : TEST_BOOST_NO_CXX11_HDR_ARRAY ; obj cxx11_hdr_atomic : test_case.cpp : TEST_BOOST_NO_CXX11_HDR_ATOMIC ; diff --git a/checks/test_case.cpp b/checks/test_case.cpp index 05f921f1..13df0b90 100644 --- a/checks/test_case.cpp +++ b/checks/test_case.cpp @@ -1,4 +1,4 @@ -// This file was automatically generated on Sun Jul 9 16:30:35 2017 +// This file was automatically generated on Wed Jan 03 23:31:31 2018 // by libs/config/tools/generate.cpp // Copyright John Maddock 2002-4. // Use, modification and distribution are subject to the @@ -291,6 +291,11 @@ # error "Defect macro BOOST_NO_CXX11_ATOMIC_SMART_PTR is defined." # endif #endif +#ifdef TEST_BOOST_NO_CXX11_DEFAULTED_MOVES +# ifdef BOOST_NO_CXX11_DEFAULTED_MOVES +# error "Defect macro BOOST_NO_CXX11_DEFAULTED_MOVES is defined." +# endif +#endif #ifdef TEST_BOOST_NO_CXX11_FINAL # ifdef BOOST_NO_CXX11_FINAL # error "Defect macro BOOST_NO_CXX11_FINAL is defined." diff --git a/doc/macro_reference.qbk b/doc/macro_reference.qbk index e89f6555..25130914 100644 --- a/doc/macro_reference.qbk +++ b/doc/macro_reference.qbk @@ -625,6 +625,9 @@ deleted (`= delete`) functions. [[`BOOST_NO_CXX11_DEFAULTED_FUNCTIONS`][The compiler does not support defaulted (`= default`) functions. ]] +[[`BOOST_NO_CXX11_DEFAULTED_MOVES`][The compiler does not support +defaulted move constructor or assignment. Other defaulted functions may still be supported. +]] [[`BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS`][The compiler does not support explicit conversion operators (`explicit operator T()`). ]] diff --git a/include/boost/config/compiler/borland.hpp b/include/boost/config/compiler/borland.hpp index fa891def..6190e390 100644 --- a/include/boost/config/compiler/borland.hpp +++ b/include/boost/config/compiler/borland.hpp @@ -174,6 +174,7 @@ #define BOOST_NO_CXX11_CONSTEXPR #define BOOST_NO_CXX11_DECLTYPE_N3276 #define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DEFAULTED_MOVES #define BOOST_NO_CXX11_DELETED_FUNCTIONS #define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS #define BOOST_NO_CXX11_HDR_INITIALIZER_LIST diff --git a/include/boost/config/compiler/gcc.hpp b/include/boost/config/compiler/gcc.hpp index c67ab818..b0e3a5ec 100644 --- a/include/boost/config/compiler/gcc.hpp +++ b/include/boost/config/compiler/gcc.hpp @@ -233,6 +233,7 @@ // #if (BOOST_GCC_VERSION < 40600) || !defined(BOOST_GCC_CXX11) #define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DEFAULTED_MOVES #define BOOST_NO_CXX11_NOEXCEPT #define BOOST_NO_CXX11_NULLPTR #define BOOST_NO_CXX11_RANGE_BASED_FOR diff --git a/include/boost/config/compiler/visualc.hpp b/include/boost/config/compiler/visualc.hpp index 8b40c45b..748d1407 100644 --- a/include/boost/config/compiler/visualc.hpp +++ b/include/boost/config/compiler/visualc.hpp @@ -167,6 +167,7 @@ // #if (_MSC_FULL_VER < 190023026) # define BOOST_NO_CXX11_NOEXCEPT +# define BOOST_NO_CXX11_DEFAULTED_MOVES # define BOOST_NO_CXX11_REF_QUALIFIERS # define BOOST_NO_CXX11_USER_DEFINED_LITERALS # define BOOST_NO_CXX11_ALIGNAS diff --git a/include/boost/config/detail/suffix.hpp b/include/boost/config/detail/suffix.hpp index 4aeac4c7..137046fb 100644 --- a/include/boost/config/detail/suffix.hpp +++ b/include/boost/config/detail/suffix.hpp @@ -687,6 +687,11 @@ namespace std{ using ::type_info; } # define BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS #endif +// Lack of defaulted moves is implied by the lack of either rvalue references or any dafaulted functions +#if !defined(BOOST_NO_CXX11_DEFAULTED_MOVES) && (defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || defined(BOOST_NO_CXX11_RVALUE_REFERENCES)) +# define BOOST_NO_CXX11_DEFAULTED_MOVES +#endif + // Defaulted and deleted function declaration helpers // These macros are intended to be inside a class definition. // BOOST_DEFAULTED_FUNCTION accepts the function declaration and its diff --git a/test/all/Jamfile.v2 b/test/all/Jamfile.v2 index d8e1636d..8b1f8c16 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 Sun Jul 9 16:30:35 2017 +# This file was automatically generated on Wed Jan 03 23:31:31 2018 # by libs/config/tools/generate.cpp # Copyright John Maddock. # Use, modification and distribution are subject to the @@ -190,6 +190,9 @@ test-suite "BOOST_NO_CXX11_ALLOCATOR" : test-suite "BOOST_NO_CXX11_ATOMIC_SMART_PTR" : [ run ../no_cxx11_atomic_sp_pass.cpp ] [ compile-fail ../no_cxx11_atomic_sp_fail.cpp ] ; +test-suite "BOOST_NO_CXX11_DEFAULTED_MOVES" : +[ run ../no_cxx11_defaulted_moves_pass.cpp ] +[ compile-fail ../no_cxx11_defaulted_moves_fail.cpp ] ; test-suite "BOOST_NO_CXX11_FINAL" : [ run ../no_cxx11_final_pass.cpp ] [ compile-fail ../no_cxx11_final_fail.cpp ] ; diff --git a/test/boost_no_cxx11_defaulted_moves.ipp b/test/boost_no_cxx11_defaulted_moves.ipp new file mode 100644 index 00000000..1e7fd941 --- /dev/null +++ b/test/boost_no_cxx11_defaulted_moves.ipp @@ -0,0 +1,25 @@ +// (C) Copyright Andrzej Krzemienski 2018 + +// 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 more information. + +// MACRO: BOOST_NO_CXX11_DEFAULTED_MOVES +// TITLE: C++0x defaulting of move constructor/assignmet unavailable +// DESCRIPTION: The compiler does not support C++0x defaulting of move constructor/assignmet + +namespace boost_no_cxx11_defaulted_moves { + + struct foo { + foo(foo&&) = default; + foo& operator=(foo&&) = default; + }; + + int test() + { + return 0; + } + +} diff --git a/test/config_info.cpp b/test/config_info.cpp index 520aa8bc..363e1e95 100644 --- a/test/config_info.cpp +++ b/test/config_info.cpp @@ -1068,6 +1068,7 @@ void print_boost_macros() PRINT_MACRO(BOOST_NO_CXX11_DECLTYPE); PRINT_MACRO(BOOST_NO_CXX11_DECLTYPE_N3276); PRINT_MACRO(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS); + PRINT_MACRO(BOOST_NO_CXX11_DEFAULTED_MOVES); PRINT_MACRO(BOOST_NO_CXX11_DELETED_FUNCTIONS); PRINT_MACRO(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS); PRINT_MACRO(BOOST_NO_CXX11_EXTERN_TEMPLATE); @@ -1200,6 +1201,7 @@ void print_boost_macros() PRINT_MACRO(BOOST_NO_VOID_RETURNS); + // END GENERATED BLOCK PRINT_MACRO(BOOST_INTEL); diff --git a/test/config_test.cpp b/test/config_test.cpp index 446fa891..0b3f9a12 100644 --- a/test/config_test.cpp +++ b/test/config_test.cpp @@ -1,4 +1,4 @@ -// This file was automatically generated on Sun Jul 9 16:30:35 2017 +// This file was automatically generated on Wed Jan 03 23:31:31 2018 // by libs/config/tools/generate.cpp // Copyright John Maddock 2002-4. // Use, modification and distribution are subject to the @@ -122,6 +122,11 @@ namespace boost_no_cxx11_allocator = empty_boost; #else namespace boost_no_cxx11_atomic_smart_ptr = empty_boost; #endif +#ifndef BOOST_NO_CXX11_DEFAULTED_MOVES +#include "boost_no_cxx11_defaulted_moves.ipp" +#else +namespace boost_no_cxx11_defaulted_moves = empty_boost; +#endif #ifndef BOOST_NO_CXX11_FINAL #include "boost_no_cxx11_final.ipp" #else @@ -1261,6 +1266,11 @@ int main( int, char *[] ) std::cerr << "Failed test for BOOST_NO_CXX11_ATOMIC_SMART_PTR at: " << __FILE__ << ":" << __LINE__ << std::endl; ++error_count; } + if(0 != boost_no_cxx11_defaulted_moves::test()) + { + std::cerr << "Failed test for BOOST_NO_CXX11_DEFAULTED_MOVES at: " << __FILE__ << ":" << __LINE__ << std::endl; + ++error_count; + } if(0 != boost_no_cxx11_final::test()) { std::cerr << "Failed test for BOOST_NO_CXX11_FINAL at: " << __FILE__ << ":" << __LINE__ << std::endl; diff --git a/test/no_cxx11_defaulted_moves_fail.cpp b/test/no_cxx11_defaulted_moves_fail.cpp new file mode 100644 index 00000000..78290126 --- /dev/null +++ b/test/no_cxx11_defaulted_moves_fail.cpp @@ -0,0 +1,37 @@ +// This file was automatically generated on Wed Jan 03 23:31:30 2018 +// 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_DEFAULTED_MOVES +// This file should not compile, if it does then +// BOOST_NO_CXX11_DEFAULTED_MOVES should not be defined. +// See file boost_no_cxx11_defaulted_moves.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_DEFAULTED_MOVES +#include "boost_no_cxx11_defaulted_moves.ipp" +#else +#error "this file should not compile" +#endif + +int main( int, char *[] ) +{ + return boost_no_cxx11_defaulted_moves::test(); +} + diff --git a/test/no_cxx11_defaulted_moves_pass.cpp b/test/no_cxx11_defaulted_moves_pass.cpp new file mode 100644 index 00000000..bf26c144 --- /dev/null +++ b/test/no_cxx11_defaulted_moves_pass.cpp @@ -0,0 +1,37 @@ +// This file was automatically generated on Wed Jan 03 23:31:30 2018 +// 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_DEFAULTED_MOVES +// This file should compile, if it does not then +// BOOST_NO_CXX11_DEFAULTED_MOVES should be defined. +// See file boost_no_cxx11_defaulted_moves.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_DEFAULTED_MOVES +#include "boost_no_cxx11_defaulted_moves.ipp" +#else +namespace boost_no_cxx11_defaulted_moves = empty_boost; +#endif + +int main( int, char *[] ) +{ + return boost_no_cxx11_defaulted_moves::test(); +} + From 0d0211e4d5d97236be4e04145b2d8d9be1920046 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Krzemie=C5=84ski?= Date: Thu, 11 Jan 2018 21:21:20 +0100 Subject: [PATCH 2/3] comment typeo fix --- include/boost/config/detail/suffix.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/config/detail/suffix.hpp b/include/boost/config/detail/suffix.hpp index 137046fb..22d31f68 100644 --- a/include/boost/config/detail/suffix.hpp +++ b/include/boost/config/detail/suffix.hpp @@ -687,7 +687,7 @@ namespace std{ using ::type_info; } # define BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS #endif -// Lack of defaulted moves is implied by the lack of either rvalue references or any dafaulted functions +// Lack of defaulted moves is implied by the lack of either rvalue references or any defaulted functions #if !defined(BOOST_NO_CXX11_DEFAULTED_MOVES) && (defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || defined(BOOST_NO_CXX11_RVALUE_REFERENCES)) # define BOOST_NO_CXX11_DEFAULTED_MOVES #endif From cb2b706bf29a248ae7fb67732d3ee4e5da1815e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Krzemie=C5=84ski?= Date: Thu, 11 Jan 2018 21:22:59 +0100 Subject: [PATCH 3/3] comment/whitespace fixes --- test/boost_no_cxx11_defaulted_moves.ipp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/boost_no_cxx11_defaulted_moves.ipp b/test/boost_no_cxx11_defaulted_moves.ipp index 1e7fd941..9bf27633 100644 --- a/test/boost_no_cxx11_defaulted_moves.ipp +++ b/test/boost_no_cxx11_defaulted_moves.ipp @@ -7,14 +7,14 @@ // See http://www.boost.org/libs/config for more information. // MACRO: BOOST_NO_CXX11_DEFAULTED_MOVES -// TITLE: C++0x defaulting of move constructor/assignmet unavailable -// DESCRIPTION: The compiler does not support C++0x defaulting of move constructor/assignmet +// TITLE: C++0x defaulting of move constructor/assignment unavailable +// DESCRIPTION: The compiler does not support C++0x defaulting of move constructor/assignment namespace boost_no_cxx11_defaulted_moves { struct foo { foo(foo&&) = default; - foo& operator=(foo&&) = default; + foo& operator=(foo&&) = default; }; int test()