Skip to content

Commit ac15f90

Browse files
committed
Fix warnings about missing sized deallocation operator in C++14 mode.
1 parent e2f6e87 commit ac15f90

3 files changed

Lines changed: 54 additions & 0 deletions

File tree

test/threads/thread/constr/FArgs_pass.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@
1818
// template <class F, class ...Args> thread(F f, Args... args);
1919

2020
#include <new>
21+
#include <cstddef>
2122
#include <cstdlib>
2223
#include <cassert>
2324
#include <boost/thread/thread_only.hpp>
2425
#include <boost/core/lightweight_test.hpp>
26+
#include <boost/config.hpp>
2527

2628
unsigned throw_one = 0xFFFF;
2729

@@ -51,6 +53,22 @@ void operator delete(void* p) BOOST_NOEXCEPT_OR_NOTHROW
5153
std::free(p);
5254
}
5355

56+
#if (defined(__cpp_sized_deallocation) && (__cpp_sized_deallocation >= 201309l)) || \
57+
(BOOST_CXX_VERSION > 201103l && \
58+
(defined(__GNUC__) && (__GNUC__ >= 5)) || \
59+
(defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4))) || \
60+
(defined(BOOST_MSVC) && (_MSC_VER >= 1900)) \
61+
)
62+
#if defined BOOST_MSVC
63+
void operator delete(void* p, std::size_t)
64+
#else
65+
void operator delete(void* p, std::size_t) BOOST_NOEXCEPT_OR_NOTHROW
66+
#endif
67+
{
68+
operator delete(p);
69+
}
70+
#endif
71+
5472
bool f_run = false;
5573

5674
void f(int i, double j)

test/threads/thread/constr/F_pass.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@
1818
// template <class F, class ...Args> thread(F f, Args... args);
1919

2020
#include <new>
21+
#include <cstddef>
2122
#include <cstdlib>
2223
#include <cassert>
2324
#include <boost/thread/thread_only.hpp>
2425
#include <boost/core/lightweight_test.hpp>
26+
#include <boost/config.hpp>
2527

2628
unsigned throw_one = 0xFFFF;
2729

@@ -51,6 +53,22 @@ void operator delete(void* p) BOOST_NOEXCEPT_OR_NOTHROW
5153
std::free(p);
5254
}
5355

56+
#if (defined(__cpp_sized_deallocation) && (__cpp_sized_deallocation >= 201309l)) || \
57+
(BOOST_CXX_VERSION > 201103l && \
58+
(defined(__GNUC__) && (__GNUC__ >= 5)) || \
59+
(defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4))) || \
60+
(defined(BOOST_MSVC) && (_MSC_VER >= 1900)) \
61+
)
62+
#if defined BOOST_MSVC
63+
void operator delete(void* p, std::size_t)
64+
#else
65+
void operator delete(void* p, std::size_t) BOOST_NOEXCEPT_OR_NOTHROW
66+
#endif
67+
{
68+
operator delete(p);
69+
}
70+
#endif
71+
5472
bool f_run = false;
5573

5674
void f()

test/threads/thread/constr/lambda_pass.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@
1818
// template <class Clousure> thread(Clousure f);
1919

2020
#include <new>
21+
#include <cstddef>
2122
#include <cstdlib>
2223
#include <cassert>
2324
#include <boost/thread/thread_only.hpp>
2425
#include <boost/core/lightweight_test.hpp>
26+
#include <boost/config.hpp>
2527

2628
#if ! defined BOOST_NO_CXX11_LAMBDAS
2729

@@ -51,6 +53,22 @@ void operator delete(void* p) BOOST_NOEXCEPT_OR_NOTHROW
5153
std::free(p);
5254
}
5355

56+
#if (defined(__cpp_sized_deallocation) && (__cpp_sized_deallocation >= 201309l)) || \
57+
(BOOST_CXX_VERSION > 201103l && \
58+
(defined(__GNUC__) && (__GNUC__ >= 5)) || \
59+
(defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4))) || \
60+
(defined(BOOST_MSVC) && (_MSC_VER >= 1900)) \
61+
)
62+
#if defined BOOST_MSVC
63+
void operator delete(void* p, std::size_t)
64+
#else
65+
void operator delete(void* p, std::size_t) BOOST_NOEXCEPT_OR_NOTHROW
66+
#endif
67+
{
68+
operator delete(p);
69+
}
70+
#endif
71+
5472
bool f_run = false;
5573

5674
int main()

0 commit comments

Comments
 (0)