Skip to content

Commit

Permalink
3.12.08 release
Browse files Browse the repository at this point in the history
  • Loading branch information
rparolin committed Jan 4, 2019
1 parent e75a74e commit 7c31d37
Show file tree
Hide file tree
Showing 12 changed files with 220 additions and 235 deletions.
360 changes: 149 additions & 211 deletions benchmark/source/BenchmarkHash.cpp

Large diffs are not rendered by default.

11 changes: 4 additions & 7 deletions benchmark/source/BenchmarkSort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,12 @@
#include "EASTLBenchmark.h"
#include "EASTLTest.h"

#ifdef _MSC_VER
#pragma warning(push, 0)
#pragma warning(disable: 4350)
#endif
EA_DISABLE_ALL_VC_WARNINGS()
#include <stdlib.h>
#include <algorithm>
#include <functional>
#include <vector>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
EA_RESTORE_ALL_VC_WARNINGS()


using namespace EA;
Expand Down Expand Up @@ -1168,6 +1163,8 @@ static int CompareSmallInputSortPerformanceHelper(eastl::vector<eastl_size_t> &a
stopwatch.Stop();
break;

case sf_qsort:
case sf_radix_sort:
case sf_count:
default:
EATEST_VERIFY_F(false, "Missing case statement for sort function %s.", GetSortFunctionName(sortFunction));
Expand Down
4 changes: 2 additions & 2 deletions include/EASTL/internal/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@
///////////////////////////////////////////////////////////////////////////////

#ifndef EASTL_VERSION
#define EASTL_VERSION "3.12.07"
#define EASTL_VERSION_N 31207
#define EASTL_VERSION "3.12.08"
#define EASTL_VERSION_N 31208
#endif


Expand Down
2 changes: 2 additions & 0 deletions include/EASTL/internal/function_detail.h
Original file line number Diff line number Diff line change
Expand Up @@ -407,13 +407,15 @@ namespace eastl
template <typename Functor, typename = EASTL_INTERNAL_FUNCTION_DETAIL_VALID_FUNCTION_ARGS(Functor, R, Args..., function_detail)>
function_detail& operator=(Functor&& functor)
{
Destroy();
CreateForwardFunctor(eastl::forward<Functor>(functor));
return *this;
}

template <typename Functor>
function_detail& operator=(eastl::reference_wrapper<Functor> f) EA_NOEXCEPT
{
Destroy();
CreateForwardFunctor(f);
return *this;
}
Expand Down
17 changes: 12 additions & 5 deletions include/EASTL/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,10 @@ namespace eastl
iterator insert(const_iterator position, const value_type& value);
iterator insert(const_iterator position, value_type&& x);
iterator insert(const_iterator position, std::initializer_list<value_type> ilist);
void insert(const_iterator position, size_type n, const value_type& value); // TODO(rparolin): return iterator C++11 support
iterator insert(const_iterator position, size_type n, const value_type& value);

template <typename InputIterator>
void insert(const_iterator position, InputIterator first, InputIterator last); // TODO(rparolin): return iterator C++11 support
iterator insert(const_iterator position, InputIterator first, InputIterator last);

iterator erase(const_iterator position);
iterator erase(const_iterator first, const_iterator last);
Expand Down Expand Up @@ -1374,18 +1374,25 @@ namespace eastl
}

template <typename T, typename Allocator>
inline void list<T, Allocator>::insert(const_iterator position, size_type n, const value_type& value)
inline typename list<T, Allocator>::iterator
list<T, Allocator>::insert(const_iterator position, size_type n, const value_type& value)
{
// To do: Get rid of DoInsertValues and put its implementation directly here.
iterator itPrev(position.mpNode);
--itPrev;
DoInsertValues((ListNodeBase*)position.mpNode, n, value);
return ++itPrev; // Inserts in front of position, returns iterator to new elements.
}


template <typename T, typename Allocator>
template <typename InputIterator>
inline void list<T, Allocator>::insert(const_iterator position, InputIterator first, InputIterator last)
inline typename list<T, Allocator>::iterator
list<T, Allocator>::insert(const_iterator position, InputIterator first, InputIterator last)
{
iterator itPrev(position.mpNode);
--itPrev;
DoInsert((ListNodeBase*)position.mpNode, first, last, is_integral<InputIterator>());
return ++itPrev; // Inserts in front of position, returns iterator to new elements.
}


Expand Down
2 changes: 1 addition & 1 deletion include/EASTL/scoped_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ namespace eastl
/// Example usage:
/// scoped_array<int> ptr(new int[6]);
/// int x = ptr[2];
T& operator[](ptrdiff_t i) const
typename add_lvalue_reference<T>::type operator[](ptrdiff_t i) const
{
// assert(mpArray && (i >= 0));
return mpArray[i];
Expand Down
2 changes: 1 addition & 1 deletion include/EASTL/scoped_ptr.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ namespace eastl
/// Example usage:
/// scoped_ptr<int> ptr(new int(3));
/// int x = *ptr;
T& operator*() const
typename add_lvalue_reference<T>::type operator*() const
{
// assert(mpValue);
return *mpValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@
#define EA_PLATFORM_DESCRIPTION "OSX on ARM64"
#elif defined(__POWERPC64__) || defined(__powerpc64__)
#define EA_PROCESSOR_POWERPC 1
#define CS_UNDEFINED_STRING 1
#define EA_PROCESSOR_POWERPC_64 1
#define EA_SYSTEM_BIG_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "OSX on PowerPC 64"
#elif defined(__POWERPC__) || defined(__powerpc__)
Expand Down Expand Up @@ -393,7 +393,7 @@
#define EA_PLATFORM_DESCRIPTION "Linux on x64"
#elif defined(__powerpc64__)
#define EA_PROCESSOR_POWERPC 1
#define CS_UNDEFINED_STRING 1
#define EA_PROCESSOR_POWERPC_64 1
#define EA_SYSTEM_BIG_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "Linux on PowerPC 64"
#elif defined(__powerpc__)
Expand Down Expand Up @@ -427,7 +427,7 @@
#define EA_PLATFORM_DESCRIPTION "BSD on x64"
#elif defined(__powerpc64__)
#define EA_PROCESSOR_POWERPC 1
#define CS_UNDEFINED_STRING 1
#define EA_PROCESSOR_POWERPC_64 1
#define EA_SYSTEM_BIG_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "BSD on PowerPC 64"
#elif defined(__powerpc__)
Expand Down
31 changes: 28 additions & 3 deletions test/source/TestFunctional.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

EA_DISABLE_ALL_VC_WARNINGS()
#include <functional>
EA_RESTORE_ALL_VC_WARNINGS();
EA_RESTORE_ALL_VC_WARNINGS()

namespace
{
Expand Down Expand Up @@ -795,7 +795,6 @@ int TestFunctional()
EATEST_VERIFY(fn0() == 1 && fn1() == 1);
}

#if !EASTL_NO_RVALUE_REFERENCES
{
eastl::function<int()> fn0 = ReturnZero;
eastl::function<int()> fn1 = ReturnOne;
Expand All @@ -804,7 +803,6 @@ int TestFunctional()
fn0 = eastl::move(fn1);
EATEST_VERIFY(fn0() == 1 && fn1 == nullptr);
}
#endif

{
eastl::function<int(int)> f1(nullptr);
Expand Down Expand Up @@ -895,6 +893,33 @@ int TestFunctional()
EATEST_VERIFY(fn() == 7);
EATEST_VERIFY(fn() == 8);
}

// user regression for memory leak when re-assigning an eastl::function which already holds a large closure.
{
static int sCtorCount = 0;
static int sDtorCount = 0;

{
struct local
{
local() { sCtorCount++; }
local(const local&) { sCtorCount++; }
local(local&&) { sCtorCount++; }
~local() { sDtorCount++; }

void operator=(const local&) = delete; // suppress msvc warning
} l;

eastl::function<bool()> f;

f = [l]() { return false; };

// ensure closure resources are cleaned up when assigning to a non-null eastl::function.
f = [l]() { return true; };
}

EATEST_VERIFY(sCtorCount == sDtorCount);
}
}

// Checking _MSC_EXTENSIONS is required because the Microsoft calling convention classifiers are only available when
Expand Down
8 changes: 6 additions & 2 deletions test/source/TestList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -618,8 +618,10 @@ int TestList()
auto insert_pos = a.begin();
eastl::advance(insert_pos, 5);

a.insert(insert_pos, 4, 42);
auto result = a.insert(insert_pos, 4, 42);
VERIFY(a == ref);
VERIFY(*result == 42);
VERIFY(*(--result) == 4);
}

// void insert(const_iterator position, InputIterator first, InputIterator last);
Expand All @@ -631,8 +633,10 @@ int TestList()
auto insert_pos = a.begin();
eastl::advance(insert_pos, 5);

a.insert(insert_pos, to_insert.begin(), to_insert.end());
auto result = a.insert(insert_pos, to_insert.begin(), to_insert.end());
VERIFY(a == ref);
VERIFY(*result == 42);
VERIFY(*(--result) == 4);
}

// iterator insert(const_iterator position, std::initializer_list<value_type> ilist);
Expand Down
2 changes: 2 additions & 0 deletions test/source/TestOptional.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,10 +539,12 @@ int TestOptional()
}
{
// user regression
EA_DISABLE_VC_WARNING(4625 4626) // copy/assignment operator constructor was implicitly defined as deleted
struct local
{
eastl::unique_ptr<int> ptr;
};
EA_RESTORE_VC_WARNING()

eastl::optional<local> o1 = local{eastl::make_unique<int>(42)};
eastl::optional<local> o2;
Expand Down
10 changes: 10 additions & 0 deletions test/source/TestSmartPtr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,11 @@ static int Test_scoped_ptr()
delete pA;
}

{
scoped_ptr<void> ptr(new int);
(void)ptr;
}

EATEST_VERIFY(A::mCount == 0);

return nErrorCount;
Expand Down Expand Up @@ -880,6 +885,11 @@ static int Test_scoped_array()
delete[] pArray;
}

{
scoped_array<void> ptr(new int[6]);
(void)ptr;
}

EATEST_VERIFY(A::mCount == 0);

return nErrorCount;
Expand Down

0 comments on commit 7c31d37

Please sign in to comment.