Skip to content
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

Add BOOST_NO_CXX17_STD_LAUNDER #470

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
5 changes: 5 additions & 0 deletions checks/test_case.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,11 @@
# error "Defect macro BOOST_NO_CXX17_STD_INVOKE is defined."
# endif
#endif
#ifdef TEST_BOOST_NO_CXX17_STD_LAUNDER
# ifdef BOOST_NO_CXX17_STD_LAUNDER
# error "Defect macro BOOST_NO_CXX17_STD_LAUNDER is defined."
# endif
#endif
#ifdef TEST_BOOST_NO_CXX17_STRUCTURED_BINDINGS
# ifdef BOOST_NO_CXX17_STRUCTURED_BINDINGS
# error "Defect macro BOOST_NO_CXX17_STRUCTURED_BINDINGS is defined."
Expand Down
12 changes: 12 additions & 0 deletions doc/html/boost_config/boost_macro_reference.html
Original file line number Diff line number Diff line change
Expand Up @@ -4184,6 +4184,18 @@ <h5>
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">BOOST_NO_CXX17_STD_LAUNDER</span></code>
</p>
</td>
<td>
<p>
The compiler does not support <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">launder</span><span class="special">()</span></code>.
</p>
</td>
</tr>
<tr>
<td>
<p>
Expand Down
1 change: 1 addition & 0 deletions doc/macro_reference.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,7 @@ that are not yet supported by a particular compiler or library.
[[`BOOST_NO_CXX17_HDR_VARIANT`][The compiler does not support the header `<variant>`.]]
[[`BOOST_NO_CXX17_STD_APPLY`][The compiler does not support `std::apply()`.]]
[[`BOOST_NO_CXX17_STD_INVOKE`][The compiler does not support `std::invoke()`.]]
[[`BOOST_NO_CXX17_STD_LAUNDER`][The compiler does not support `std::launder()`.]]
[[`BOOST_NO_CXX17_ITERATOR_TRAITS`][The compiler does not support SFINAE-friendly `std::iterator_traits`.]]
[[`BOOST_NO_CXX17_IF_CONSTEXPR`][The compiler does not support `if constexpr`.]]
[[`BOOST_NO_CXX17_INLINE_VARIABLES`][The compiler does not support `inline` variables.]]
Expand Down
3 changes: 3 additions & 0 deletions include/boost/config/assert_cxx17.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,6 @@
#ifdef BOOST_NO_CXX17_STRUCTURED_BINDINGS
# error "Your compiler appears not to be fully C++17 compliant. Detected via defect macro BOOST_NO_CXX17_STRUCTURED_BINDINGS."
#endif
#ifdef BOOST_NO_CXX17_STD_LAUNDER
# error "Your compiler appears not to be fully C++17 compliant. Detected via defect macro BOOST_NO_CXX17_STD_LAUNDER."
#endif
1 change: 1 addition & 0 deletions include/boost/config/detail/cxx_composite.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@
|| defined(BOOST_NO_CXX17_ITERATOR_TRAITS)\
|| defined(BOOST_NO_CXX17_STD_APPLY)\
|| defined(BOOST_NO_CXX17_STD_INVOKE)\
|| defined(BOOST_NO_CXX17_STD_LAUNDER)\
|| defined(BOOST_NO_CXX17_STRUCTURED_BINDINGS)
# define BOOST_NO_CXX17
#endif
Expand Down
3 changes: 3 additions & 0 deletions include/boost/config/stdlib/dinkumware.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@
#if !defined(_CPPLIB_VER) || (_CPPLIB_VER < 650) || !defined(_HAS_CXX17) || (_HAS_CXX17 == 0) || !defined(_MSVC_STL_UPDATE) || (_MSVC_STL_UPDATE < 201709)
# define BOOST_NO_CXX17_STD_INVOKE
#endif
#if !defined(_CPPLIB_VER) || (_CPPLIB_VER < 650) || !defined(_HAS_CXX17) || (_HAS_CXX17 == 0) || !defined(_MSVC_STL_VERSION) || (_MSVC_STL_VERSION < 141)
# define BOOST_NO_CXX17_STD_LAUNDER
#endif

// C++20 features which aren't configured in suffix.hpp correctly:
#if !defined(_MSVC_STL_UPDATE) || (_MSVC_STL_UPDATE < 202008L) || !defined(_HAS_CXX20) || (_HAS_CXX20 == 0)
Expand Down
1 change: 1 addition & 0 deletions include/boost/config/stdlib/libcomo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
// C++17 features
# define BOOST_NO_CXX17_STD_APPLY
# define BOOST_NO_CXX17_STD_INVOKE
# define BOOST_NO_CXX17_STD_LAUNDER
# define BOOST_NO_CXX17_ITERATOR_TRAITS

//
Expand Down
3 changes: 3 additions & 0 deletions include/boost/config/stdlib/libcpp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@
# define BOOST_NO_CXX17_HDR_STRING_VIEW
# define BOOST_NO_CXX17_HDR_VARIANT
#endif
#if (_LIBCPP_VERSION < 6000) || (__cplusplus <= 201402L)
# define BOOST_NO_CXX17_STD_LAUNDER
#endif
#if (_LIBCPP_VERSION > 4000) && (__cplusplus > 201402L) && !defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
# define BOOST_NO_AUTO_PTR
#endif
Expand Down
5 changes: 5 additions & 0 deletions include/boost/config/stdlib/libstdcpp3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,14 @@ extern "C" char *gets (char *__s);
#if (BOOST_LIBSTDCXX_VERSION < 70100) || (__cplusplus <= 201402L)
# define BOOST_NO_CXX17_STD_INVOKE
# define BOOST_NO_CXX17_STD_APPLY
# define BOOST_NO_CXX17_STD_LAUNDER
# define BOOST_NO_CXX17_HDR_OPTIONAL
# define BOOST_NO_CXX17_HDR_STRING_VIEW
# define BOOST_NO_CXX17_HDR_VARIANT
#elif !defined(_GLIBCXX_HAVE_BUILTIN_LAUNDER)
//Older Clang compilers have no builtin, so libstdc++ disables
//std::launder on those cases
# define BOOST_NO_CXX17_STD_LAUNDER
#endif

#if defined(__has_include)
Expand Down
1 change: 1 addition & 0 deletions include/boost/config/stdlib/modena.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
// C++17 features
# define BOOST_NO_CXX17_STD_APPLY
# define BOOST_NO_CXX17_STD_INVOKE
# define BOOST_NO_CXX17_STD_LAUNDER
# define BOOST_NO_CXX17_ITERATOR_TRAITS

#define BOOST_STDLIB "Modena C++ standard library"
Expand Down
1 change: 1 addition & 0 deletions include/boost/config/stdlib/msl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
// C++17 features
# define BOOST_NO_CXX17_STD_APPLY
# define BOOST_NO_CXX17_STD_INVOKE
# define BOOST_NO_CXX17_STD_LAUNDER
# define BOOST_NO_CXX17_ITERATOR_TRAITS

#define BOOST_STDLIB "Metrowerks Standard Library version " BOOST_STRINGIZE(__MSL_CPP__)
1 change: 1 addition & 0 deletions include/boost/config/stdlib/roguewave.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,5 @@
// C++17 features
# define BOOST_NO_CXX17_STD_APPLY
# define BOOST_NO_CXX17_STD_INVOKE
# define BOOST_NO_CXX17_STD_LAUNDER
# define BOOST_NO_CXX17_ITERATOR_TRAITS
1 change: 1 addition & 0 deletions include/boost/config/stdlib/sgi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@
// C++17 features
# define BOOST_NO_CXX17_STD_APPLY
# define BOOST_NO_CXX17_STD_INVOKE
# define BOOST_NO_CXX17_STD_LAUNDER
# define BOOST_NO_CXX17_ITERATOR_TRAITS

#define BOOST_STDLIB "SGI standard library"
1 change: 1 addition & 0 deletions include/boost/config/stdlib/stlport.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ namespace boost { using std::min; using std::max; }
// C++17 features
# define BOOST_NO_CXX17_STD_APPLY
# define BOOST_NO_CXX17_STD_INVOKE
# define BOOST_NO_CXX17_STD_LAUNDER
# define BOOST_NO_CXX17_ITERATOR_TRAITS

#define BOOST_STDLIB "STLPort standard library version " BOOST_STRINGIZE(__SGI_STL_PORT)
1 change: 1 addition & 0 deletions include/boost/config/stdlib/vacpp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
// C++17 features
# define BOOST_NO_CXX17_STD_APPLY
# define BOOST_NO_CXX17_STD_INVOKE
# define BOOST_NO_CXX17_STD_LAUNDER
# define BOOST_NO_CXX17_ITERATOR_TRAITS

#define BOOST_STDLIB "Visual Age default standard library"
1 change: 1 addition & 0 deletions include/boost/config/stdlib/xlcpp_zos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,5 @@

#define BOOST_NO_CXX17_STD_INVOKE
#define BOOST_NO_CXX17_STD_APPLY
#define BOOST_NO_CXX17_STD_LAUNDER
#define BOOST_NO_CXX17_ITERATOR_TRAITS
3 changes: 3 additions & 0 deletions test/all/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ test-suite "BOOST_NO_CXX17_STD_APPLY" :
test-suite "BOOST_NO_CXX17_STD_INVOKE" :
[ run ../no_cxx17_std_invoke_pass.cpp ]
[ compile-fail ../no_cxx17_std_invoke_fail.cpp ] ;
test-suite "BOOST_NO_CXX17_STD_LAUNDER" :
[ run ../no_cxx17_std_launder_pass.cpp ]
[ compile-fail ../no_cxx17_std_launder_fail.cpp ] ;
test-suite "BOOST_NO_CXX17_STRUCTURED_BINDINGS" :
[ run ../no_cxx17_structured_bindings_pass.cpp ]
[ compile-fail ../no_cxx17_structured_bindings_fail.cpp ] ;
Expand Down
28 changes: 28 additions & 0 deletions test/boost_no_cxx17_std_launder.ipp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// (C) Copyright Ion Gaztanaga.
// 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 most recent version.

// MACRO: BOOST_NO_CXX17_STD_LAUNDER
// TITLE: launder
// DESCRIPTION: The compiler supports the std::launder() function.

#include <new>

namespace boost_no_cxx17_std_launder {

struct X
{
const int const_int;
};

int test()
{
X original{1};
new (&original) X{2}; //Overwrite X
return std::launder(&original)->const_int == 2 ? 0 : -1; //After laundering, new value should be returned
}

}
1 change: 1 addition & 0 deletions test/config_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,7 @@ void print_boost_macros()
PRINT_MACRO(BOOST_NO_CXX17_ITERATOR_TRAITS);
PRINT_MACRO(BOOST_NO_CXX17_STD_APPLY);
PRINT_MACRO(BOOST_NO_CXX17_STD_INVOKE);
PRINT_MACRO(BOOST_NO_CXX17_STD_LAUNDER);
PRINT_MACRO(BOOST_NO_CXX17_STRUCTURED_BINDINGS);
PRINT_MACRO(BOOST_NO_CXX20_HDR_BARRIER);
PRINT_MACRO(BOOST_NO_CXX20_HDR_BIT);
Expand Down
5 changes: 5 additions & 0 deletions test/config_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,11 @@ namespace boost_no_cxx17_std_apply = empty_boost;
#else
namespace boost_no_cxx17_std_invoke = empty_boost;
#endif
#ifndef BOOST_NO_CXX17_STD_LAUNDER
#include "boost_no_cxx17_std_launder.ipp"
#else
namespace boost_no_cxx17_std_launder = empty_boost;
#endif
#ifndef BOOST_NO_CXX17_STRUCTURED_BINDINGS
#include "boost_no_cxx17_structured_bindings.ipp"
#else
Expand Down
5 changes: 5 additions & 0 deletions test/config_test.cu
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,11 @@ namespace boost_no_cxx17_std_apply = empty_boost;
#else
namespace boost_no_cxx17_std_invoke = empty_boost;
#endif
#ifndef BOOST_NO_CXX17_STD_LAUNDER
#include "boost_no_cxx17_std_launder.ipp"
#else
namespace boost_no_cxx17_std_launder = empty_boost;
#endif
#ifndef BOOST_NO_CXX17_STRUCTURED_BINDINGS
#include "boost_no_cxx17_structured_bindings.ipp"
#else
Expand Down
4 changes: 2 additions & 2 deletions test/no_cxx14_std_exchange_fail.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
//


// Test file for macro BOOST_NO_CXX17_STD_APPLY
// Test file for macro BOOST_NO_CXX14_STD_EXCHANGE
// This file should not compile, if it does then
// BOOST_NO_CXX17_STD_APPLY should not be defined.
// BOOST_NO_CXX14_STD_EXCHANGE should not be defined.
// See file boost_no_cxx17_std_apply.ipp for details

// Must not have BOOST_ASSERT_CONFIG set; it defeats
Expand Down
4 changes: 2 additions & 2 deletions test/no_cxx14_std_exchange_pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
//


// Test file for macro BOOST_NO_CXX17_STD_APPLY
// Test file for macro BOOST_NO_CXX14_STD_EXCHANGE
// This file should compile, if it does not then
// BOOST_NO_CXX!/_STD_APPLY should be defined.
// See file boost_no_cxx17_std_apply.ipp for details
// See file boost_no_cxx14_std_exchange.ipp for details

// Must not have BOOST_ASSERT_CONFIG set; it defeats
// the objective of this file:
Expand Down
37 changes: 37 additions & 0 deletions test/no_cxx17_std_launder_fail.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// This file was automatically generated on Fri Oct 14 12:13:46 2016
// 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_CXX17_STD_LAUNDER
// This file should not compile, if it does then
// BOOST_NO_CXX17_STD_LAUNDER should not be defined.
// See file boost_no_cxx17_std_launder.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 <boost/config.hpp>
#include "test.hpp"

#ifdef BOOST_NO_CXX17_STD_LAUNDER
#include "boost_no_cxx17_std_launder.ipp"
#else
#error "this file should not compile"
#endif

int main( int, char *[] )
{
return boost_no_cxx17_std_launder::test();
}

37 changes: 37 additions & 0 deletions test/no_cxx17_std_launder_pass.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// This file was automatically generated on Fri Oct 14 12:13:46 2016
// 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_CXX17_STD_LAUNDER
// This file should compile, if it does not then
// BOOST_NO_CXX17_STD_LAUNDER should be defined.
// See file boost_no_cxx17_std_launder.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 <boost/config.hpp>
#include "test.hpp"

#ifndef BOOST_NO_CXX17_STD_LAUNDER
#include "boost_no_cxx17_std_launder.ipp"
#else
namespace boost_no_cxx17_std_launder = empty_boost;
#endif

int main( int, char *[] )
{
return boost_no_cxx17_std_launder::test();
}