Skip to content

Commit

Permalink
Merge branch '3.07.02'
Browse files Browse the repository at this point in the history
  • Loading branch information
rparolin committed Feb 11, 2018
2 parents 036fa88 + e1ee3f2 commit 52c0c7a
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 44 deletions.
50 changes: 19 additions & 31 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ addons:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.8
- g++-4.8
- gcc-6
- g++-6
- clang
- libc++-dev

Expand All @@ -33,9 +33,6 @@ matrix:
- compiler: clang "release build with clang3.9"
env: EASTL_CONFIG=Release USE_CLANG_39=yes
os: osx
- compiler: clang "build with Buck"
env: USE_BUCK=yes
os: osx
exclude:
- os: osx
compiler: gcc
Expand All @@ -47,11 +44,11 @@ install:

# Linux Setup
# CMake
- if [[ "$TRAVIS_OS_NAME" == "linux" && ! -n "$USE_BUCK" ]]; then wget --no-check-certificate http://cmake.org/files/v3.1/cmake-3.1.3-Linux-x86_64.tar.gz ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" && ! -n "$USE_BUCK" ]]; then tar -xzf cmake-3.1.3-Linux-x86_64.tar.gz ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then wget --no-check-certificate http://cmake.org/files/v3.1/cmake-3.1.3-Linux-x86_64.tar.gz ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then tar -xzf cmake-3.1.3-Linux-x86_64.tar.gz ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export PATH=$PWD/cmake-3.1.3-Linux-x86_64/bin:$PATH ;fi
# GCC
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$CXX" = "g++" ]]; then export CXX="g++-4.8" CC="gcc-4.8" ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$CXX" = "g++" ]]; then export CXX="g++-6" CC="gcc-6" ;fi
# Linuxbrew
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then test -d $HOME/.linuxbrew/bin || git clone https://github.com/Linuxbrew/brew.git $HOME/.linuxbrew ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then PATH="$HOME/.linuxbrew/bin:$PATH" ;fi
Expand All @@ -60,15 +57,15 @@ install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export INFOPATH="$(brew --prefix)/share/info:$INFOPATH" ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then brew --version ;fi
# Linuxbrew GCC
- if [[ "$TRAVIS_OS_NAME" == "linux" && -n "$USE_BUCK" ]]; then brew install gcc ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" && -n "$USE_BUCK" ]]; then which gcc ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" && -n "$USE_BUCK" ]]; then gcc --version ;fi
# - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then brew install gcc ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then which gcc ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then gcc --version ;fi

# OSX Setup
# CMake
- if [[ "$TRAVIS_OS_NAME" == "osx" && ! -n "$USE_BUCK" ]]; then wget --no-check-certificate http://cmake.org/files/v3.1/cmake-3.1.3-Darwin-x86_64.tar.gz ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && ! -n "$USE_BUCK" ]]; then tar -xzf cmake-3.1.3-Darwin-x86_64.tar.gz ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && ! -n "$USE_BUCK" ]]; then export PATH=$PWD/cmake-3.1.3-Darwin-x86_64/CMake.app/Contents/bin:$PATH ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then wget --no-check-certificate http://cmake.org/files/v3.1/cmake-3.1.3-Darwin-x86_64.tar.gz ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then tar -xzf cmake-3.1.3-Darwin-x86_64.tar.gz ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export PATH=$PWD/cmake-3.1.3-Darwin-x86_64/CMake.app/Contents/bin:$PATH ;fi
# Clang 3.9
- if [[ "$TRAVIS_OS_NAME" == "osx" && -n "$USE_CLANG_39" ]]; then export CLANG_URL=http://releases.llvm.org/3.9.0/clang+llvm-3.9.0-x86_64-apple-darwin.tar.xz ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && -n "$USE_CLANG_39" ]]; then wget --no-check-certificate $CLANG_URL ;fi
Expand All @@ -83,12 +80,6 @@ install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew --version ;fi

# Universal Setup
# Buck
- if [[ -n "$USE_BUCK" ]]; then brew install ant ;fi
- if [[ -n "$USE_BUCK" ]]; then brew tap facebook/fb ;fi
- if [[ -n "$USE_BUCK" ]]; then brew install buck ;fi
- if [[ -n "$USE_BUCK" ]]; then buck --version ;fi

before_script:
- if [[ "$CXX" == "clang++" ]]; then export CXXFLAGS="$CXXFLAGS -I${LLVM_ROOT}/install/include -std=c++14 -stdlib=libc++" ;fi
- if [[ "$CXX" == "clang++" ]]; then export LDFLAGS="$LDFLAGS -L${LLVM_ROOT}/install/lib" ;fi
Expand All @@ -97,21 +88,18 @@ before_script:
- if [[ -n "$USE_CLANG_39" ]]; then export CXX="clang++" ;fi
- if [[ -n "$USE_CLANG_39" ]]; then export CXXFLAGS="$CXXFLAGS -I${CLANG_39_PATH}/include -std=c++14 -stdlib=libc++" ;fi
- if [[ -n "$USE_CLANG_39" ]]; then export LDFLAGS="$LDFLAGS -L${CLANG_39_PATH}/lib" ;fi
- if [[ ! -n "$USE_BUCK" ]]; then mkdir build_$EASTL_CONFIG ;fi
- if [[ ! -n "$USE_BUCK" ]]; then cd build_$EASTL_CONFIG ;fi
- if [[ ! -n "$USE_BUCK" ]]; then cmake .. -DEASTL_BUILD_BENCHMARK:BOOL=ON -DEASTL_BUILD_TESTS:BOOL=ON ;fi
- if [[ ! -n "$USE_BUCK" ]]; then cmake --build . --config $EASTL_CONFIG ;fi
- mkdir build_$EASTL_CONFIG
- cd build_$EASTL_CONFIG
- cmake .. -DEASTL_BUILD_BENCHMARK:BOOL=ON -DEASTL_BUILD_TESTS:BOOL=ON
- cmake --build . --config $EASTL_CONFIG

script:
# Run the Buck build and tests
- if [[ -n "$USE_BUCK" ]]; then buck build :eastl ;fi
- if [[ -n "$USE_BUCK" ]]; then buck run :test-runner ;fi
# Run Tests
- if [[ ! -n "$USE_BUCK" ]]; then cd $TRAVIS_BUILD_DIR/build_$EASTL_CONFIG/test ;fi
- if [[ ! -n "$USE_BUCK" ]]; then ctest -C $EASTL_CONFIG -V || exit 1 ;fi
- cd $TRAVIS_BUILD_DIR/build_$EASTL_CONFIG/test
- ctest -C $EASTL_CONFIG -V || exit 1
# Run Benchmarks
- if [[ ! -n "$USE_BUCK" ]]; then cd $TRAVIS_BUILD_DIR/build_$EASTL_CONFIG/benchmark ;fi
- if [[ ! -n "$USE_BUCK" ]]; then ctest -C $EASTL_CONFIG -V || exit 1 ;fi
- cd $TRAVIS_BUILD_DIR/build_$EASTL_CONFIG/benchmark
- ctest -C $EASTL_CONFIG -V || exit 1

branches:
except:
Expand Down
22 changes: 11 additions & 11 deletions include/EASTL/fixed_function.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ namespace ff_detail
static const int SIZE_IN_BYTES = SIZE_IN_BYTES_T;

functor_storage_type_with_size functor;
const function_table* function_table;
const function_table* function_table_ptr;
};


Expand Down Expand Up @@ -173,7 +173,7 @@ namespace ff_detail
template<typename T, typename TotalStorageType>
static void init_function_table(TotalStorageType& storage)
{
storage.function_table = &get_default_function_table<T, TotalStorageType>();
storage.function_table_ptr = &get_default_function_table<T, TotalStorageType>();
}


Expand Down Expand Up @@ -339,7 +339,7 @@ class fixed_function<SIZE_IN_BYTES, Result (Arguments...)>
fixed_function(const fixed_function& other)
: call(other.call)
{
other.storage.function_table->call_copy(eastl::addressof(storage), eastl::addressof(other.storage));
other.storage.function_table_ptr->call_copy(eastl::addressof(storage), eastl::addressof(other.storage));
}

template <typename T>
Expand All @@ -360,7 +360,7 @@ class fixed_function<SIZE_IN_BYTES, Result (Arguments...)>
fixed_function& operator=(const fixed_function& other) EA_NOEXCEPT
{
call = other.call;
other.storage.function_table->call_copy(eastl::addressof(storage), eastl::addressof(other.storage));
other.storage.function_table_ptr->call_copy(eastl::addressof(storage), eastl::addressof(other.storage));
return *this;
}

Expand All @@ -387,7 +387,7 @@ class fixed_function<SIZE_IN_BYTES, Result (Arguments...)>

~fixed_function() EA_NOEXCEPT
{
storage.function_table->call_destroy(eastl::addressof(storage));
storage.function_table_ptr->call_destroy(eastl::addressof(storage));
}

Result operator()(Arguments... arguments) const
Expand All @@ -398,29 +398,29 @@ class fixed_function<SIZE_IN_BYTES, Result (Arguments...)>
void swap(fixed_function& other) EA_NOEXCEPT
{
total_storage_type_with_size temp_storage;
other.storage.function_table->call_move_and_destroy(eastl::addressof(temp_storage), eastl::addressof(other.storage));
storage.function_table->call_move_and_destroy(eastl::addressof(other.storage), eastl::addressof(storage));
temp_storage.function_table->call_move_and_destroy(eastl::addressof(storage), eastl::addressof(temp_storage));
other.storage.function_table_ptr->call_move_and_destroy(eastl::addressof(temp_storage), eastl::addressof(other.storage));
storage.function_table_ptr->call_move_and_destroy(eastl::addressof(other.storage), eastl::addressof(storage));
temp_storage.function_table_ptr->call_move_and_destroy(eastl::addressof(storage), eastl::addressof(temp_storage));

eastl::swap(call, other.call);
}

#ifndef FUNC_NO_RTTI
const std::type_info& target_type() const EA_NOEXCEPT
{
return storage.function_table->call_type_id();
return storage.function_table_ptr->call_type_id();
}

template<typename T>
T* target() EA_NOEXCEPT
{
return static_cast<T*>(storage.function_table->call_target(eastl::addressof(storage), typeid(T)));
return static_cast<T*>(storage.function_table_ptr->call_target(eastl::addressof(storage), typeid(T)));
}

template<typename T>
const T* target() const EA_NOEXCEPT
{
return static_cast<const T*>(storage.function_table->call_target(eastl::addressof(storage), typeid(T)));
return static_cast<const T*>(storage.function_table_ptr->call_target(eastl::addressof(storage), typeid(T)));
}
#endif

Expand Down
10 changes: 8 additions & 2 deletions test/source/TestFunctional.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,13 +495,19 @@ int TestFunctional()
static_assert(eastl::is_same<typename eastl::invoke_result<decltype(&TestStruct::value), eastl::reference_wrapper<TestStruct>>::type, int &>::value, "incorrect type for invoke_result");
static_assert(eastl::is_invocable<decltype(&TestStruct::GetValue), eastl::reference_wrapper<TestStruct>>::value, "incorrect value for is_invocable");
}

#ifndef EA_COMPILER_GNUC
{
TestStruct a(42);
EATEST_VERIFY(eastl::invoke(&TestStruct::GetValue, a) == 42);

static_assert(eastl::is_same<typename eastl::invoke_result<decltype(&TestStruct::GetValue), TestStruct *>::type, int>::value, "incorrect type for invoke_result");
static_assert(eastl::is_invocable<decltype(&TestStruct::GetValue), TestStruct *>::value, "incorrect value for is_invocable");
static_assert(
eastl::is_same<typename eastl::invoke_result<decltype(&TestStruct::GetValue), TestStruct*>::type, int>::value,
"incorrect type for invoke_result");

static_assert(eastl::is_invocable<decltype(&TestStruct::GetValue), TestStruct*>::value, "incorrect value for is_invocable");
}
#endif
{
TestFunctor f;
eastl::invoke(f);
Expand Down

0 comments on commit 52c0c7a

Please sign in to comment.