2
0
mirror of https://github.com/boostorg/thread.git synced 2026-02-09 11:32:12 +00:00

Fix warnings about missing sized deallocation operator in C++14 mode.

This commit is contained in:
Andrey Semashev
2026-02-06 15:45:40 +03:00
parent e2f6e8789f
commit ac15f907be
3 changed files with 54 additions and 0 deletions

View File

@@ -18,10 +18,12 @@
// template <class F, class ...Args> thread(F f, Args... args);
#include <new>
#include <cstddef>
#include <cstdlib>
#include <cassert>
#include <boost/thread/thread_only.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/config.hpp>
unsigned throw_one = 0xFFFF;
@@ -51,6 +53,22 @@ void operator delete(void* p) BOOST_NOEXCEPT_OR_NOTHROW
std::free(p);
}
#if (defined(__cpp_sized_deallocation) && (__cpp_sized_deallocation >= 201309l)) || \
(BOOST_CXX_VERSION > 201103l && \
(defined(__GNUC__) && (__GNUC__ >= 5)) || \
(defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4))) || \
(defined(BOOST_MSVC) && (_MSC_VER >= 1900)) \
)
#if defined BOOST_MSVC
void operator delete(void* p, std::size_t)
#else
void operator delete(void* p, std::size_t) BOOST_NOEXCEPT_OR_NOTHROW
#endif
{
operator delete(p);
}
#endif
bool f_run = false;
void f(int i, double j)

View File

@@ -18,10 +18,12 @@
// template <class F, class ...Args> thread(F f, Args... args);
#include <new>
#include <cstddef>
#include <cstdlib>
#include <cassert>
#include <boost/thread/thread_only.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/config.hpp>
unsigned throw_one = 0xFFFF;
@@ -51,6 +53,22 @@ void operator delete(void* p) BOOST_NOEXCEPT_OR_NOTHROW
std::free(p);
}
#if (defined(__cpp_sized_deallocation) && (__cpp_sized_deallocation >= 201309l)) || \
(BOOST_CXX_VERSION > 201103l && \
(defined(__GNUC__) && (__GNUC__ >= 5)) || \
(defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4))) || \
(defined(BOOST_MSVC) && (_MSC_VER >= 1900)) \
)
#if defined BOOST_MSVC
void operator delete(void* p, std::size_t)
#else
void operator delete(void* p, std::size_t) BOOST_NOEXCEPT_OR_NOTHROW
#endif
{
operator delete(p);
}
#endif
bool f_run = false;
void f()

View File

@@ -18,10 +18,12 @@
// template <class Clousure> thread(Clousure f);
#include <new>
#include <cstddef>
#include <cstdlib>
#include <cassert>
#include <boost/thread/thread_only.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/config.hpp>
#if ! defined BOOST_NO_CXX11_LAMBDAS
@@ -51,6 +53,22 @@ void operator delete(void* p) BOOST_NOEXCEPT_OR_NOTHROW
std::free(p);
}
#if (defined(__cpp_sized_deallocation) && (__cpp_sized_deallocation >= 201309l)) || \
(BOOST_CXX_VERSION > 201103l && \
(defined(__GNUC__) && (__GNUC__ >= 5)) || \
(defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4))) || \
(defined(BOOST_MSVC) && (_MSC_VER >= 1900)) \
)
#if defined BOOST_MSVC
void operator delete(void* p, std::size_t)
#else
void operator delete(void* p, std::size_t) BOOST_NOEXCEPT_OR_NOTHROW
#endif
{
operator delete(p);
}
#endif
bool f_run = false;
int main()