diff --git a/.github/workflows/clang.yml b/.github/workflows/clang.yml index 237ac4b6..1a278584 100644 --- a/.github/workflows/clang.yml +++ b/.github/workflows/clang.yml @@ -1,94 +1,18 @@ name: clang on: push: - branches: [ master ] + branches: [ hotfix/attempt-to-fix-clang-ci-error ] pull_request: branches: [ master ] jobs: - build-clang-9-linux-stl: - name: Clang-9 Linux - STL - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-20.04] - - steps: - - uses: actions/checkout@v2 - - - name: Build - run: | - sudo apt-get update - sudo apt-get install -y "clang-9" "lldb-9" "lld-9" "clang-format-9" - export CC=clang-9 - export CXX=clang++-9 - export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 - git fetch --tags - cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF ./ - clang --version - make - - - name: Run tests - run: ./test/etl_tests - - build-clang-9-linux-no-stl: - name: Clang-9 Linux - No STL - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-20.04] - - steps: - - uses: actions/checkout@v2 - - - name: Build - run: | - sudo apt-get update - sudo apt-get install -y "clang-9" "lldb-9" "lld-9" "clang-format-9" - export CC=clang-9 - export CXX=clang++-9 - export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 - git fetch --tags - cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF ./ - gcc --version - cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF ./ - clang --version - make - - - name: Run tests - run: ./test/etl_tests - - build-clang-9-linux-stl-force-cpp03: - name: Clang-9 Linux - STL - Force C++03 - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-20.04] - - steps: - - uses: actions/checkout@v2 - - - name: Build - run: | - sudo apt-get update - sudo apt-get install -y "clang-9" "lldb-9" "lld-9" "clang-format-9" - export CC=clang-9 - export CXX=clang++-9 - export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 - git fetch --tags - cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON ./ - clang --version - make - - - name: Run tests - run: ./test/etl_tests build-clang-10-osx-stl: name: Clang-10 OSX - STL runs-on: ${{ matrix.os }} strategy: matrix: - os: [macos-10.15] + os: [macos-11] steps: - uses: actions/checkout@v2 @@ -106,49 +30,3 @@ jobs: - name: Run tests run: ./test/etl_tests - build-clang-10-osx-no-stl: - name: Clang-10 OSX - No STL - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-10.15] - - steps: - - uses: actions/checkout@v2 - - - name: Build - run: | - export CC=clang - export CXX=clang++ - export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 - git fetch --tags - cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF ./ - clang --version - make - - - name: Run tests - run: ./test/etl_tests - - build-clang-10-osx-stl-force-cpp03: - name: Clang-10 OSX - STL - Force C++03 - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-10.15] - - steps: - - uses: actions/checkout@v2 - - - name: Build - run: | - export CC=clang - export CXX=clang++ - export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 - git fetch --tags - cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON ./ - clang --version - make - - - name: Run tests - run: ./test/etl_tests - diff --git a/include/etl/platform.h b/include/etl/platform.h index 770090d1..6c21e285 100644 --- a/include/etl/platform.h +++ b/include/etl/platform.h @@ -31,6 +31,7 @@ SOFTWARE. #ifndef ETL_PLATFORM_INCLUDED #define ETL_PLATFORM_INCLUDED +#include #include #include diff --git a/include/etl/unordered_map.h b/include/etl/unordered_map.h index 6308cce2..bc0ff25a 100644 --- a/include/etl/unordered_map.h +++ b/include/etl/unordered_map.h @@ -158,13 +158,13 @@ namespace etl value_type key_value_pair; }; - friend static bool operator ==(const node_t& lhs, const node_t& rhs) + friend bool operator ==(const node_t& lhs, const node_t& rhs) { return (lhs.key_value_pair.first == rhs.key_value_pair.first) && (lhs.key_value_pair.second == rhs.key_value_pair.second); } - friend static bool operator !=(const node_t& lhs, const node_t& rhs) + friend bool operator !=(const node_t& lhs, const node_t& rhs) { return !(lhs == rhs); } diff --git a/test/test_murmur3.cpp b/test/test_murmur3.cpp index 31205021..e5217d5a 100644 --- a/test/test_murmur3.cpp +++ b/test/test_murmur3.cpp @@ -44,12 +44,16 @@ namespace //************************************************************************* TEST(test_murmur3_32_constructor) { - std::string data("123456789"); + std::aligned_storage_t> storage[10]; + std::string data("123456789"); - uint32_t hash = etl::murmur3(data.begin(), data.end()); + char* begin = (char*)&storage[0]; + strcpy(begin, data.c_str()); + + uint32_t hash = etl::murmur3(begin, begin + data.size()); uint32_t compare; - MurmurHash3_x86_32(data.c_str(), data.size(), 0, &compare); + MurmurHash3_x86_32(begin, data.size(), 0, &compare); CHECK_EQUAL(compare, hash); } @@ -57,8 +61,12 @@ namespace //************************************************************************* TEST(test_murmur3_32_add_values) { + std::aligned_storage_t> storage[10]; std::string data("123456789"); + char* begin = (char*)&storage[0]; + strcpy(begin, data.c_str()); + etl::murmur3 murmur3_32_calculator; for (size_t i = 0UL; i < data.size(); ++i) @@ -69,7 +77,7 @@ namespace uint32_t hash = murmur3_32_calculator; uint32_t compare; - MurmurHash3_x86_32(data.c_str(), data.size(), 0, &compare); + MurmurHash3_x86_32(begin, data.size(), 0, &compare); CHECK_EQUAL(compare, hash); } @@ -77,8 +85,12 @@ namespace //************************************************************************* TEST(test_murmur3_32_add_range) { + std::aligned_storage_t> storage[10]; std::string data("123456789"); + char* begin = (char*)&storage[0]; + strcpy(begin, data.c_str()); + etl::murmur3 murmur3_32_calculator; murmur3_32_calculator.add(data.begin(), data.end()); @@ -86,7 +98,7 @@ namespace uint32_t hash = murmur3_32_calculator.value(); uint32_t compare; - MurmurHash3_x86_32(data.c_str(), data.size(), 0, &compare); + MurmurHash3_x86_32(begin, data.size(), 0, &compare); CHECK_EQUAL(compare, hash); } diff --git a/test/test_unordered_map.cpp b/test/test_unordered_map.cpp index 51da6f58..221dcfee 100644 --- a/test/test_unordered_map.cpp +++ b/test/test_unordered_map.cpp @@ -419,7 +419,8 @@ namespace bool isEqual = std::equal(data.begin(), data.end(), - other_data.begin()); + other_data.begin(), + std::equal_to()); CHECK(isEqual); } @@ -435,7 +436,7 @@ namespace idata2 = idata1; - bool isEqual = std::equal(data1.begin(), + bool isEqual = etl::equal(data1.begin(), data1.end(), data2.begin()); @@ -452,7 +453,7 @@ namespace other_data = other_data; #include "etl/private/diagnostic_pop.h" - bool isEqual = std::equal(data.begin(), + bool isEqual = etl::equal(data.begin(), data.end(), other_data.begin()); diff --git a/test/test_unordered_multimap.cpp b/test/test_unordered_multimap.cpp index cde409c9..66f89276 100644 --- a/test/test_unordered_multimap.cpp +++ b/test/test_unordered_multimap.cpp @@ -37,6 +37,7 @@ SOFTWARE. #include #include #include +#include #include "data.h" @@ -338,7 +339,7 @@ namespace other_data = data; - bool isEqual = std::equal(data.begin(), + bool isEqual = etl::equal(data.begin(), data.end(), other_data.begin()); @@ -356,7 +357,7 @@ namespace idata2 = idata1; - bool isEqual = std::equal(data1.begin(), + bool isEqual = etl::equal(data1.begin(), data1.end(), data2.begin()); @@ -374,7 +375,7 @@ namespace #include "etl/private/diagnostic_pop.h" - bool isEqual = std::equal(data.begin(), + bool isEqual = etl::equal(data.begin(), data.end(), other_data.begin()); diff --git a/test/test_unordered_multiset.cpp b/test/test_unordered_multiset.cpp index 06918926..b15236db 100644 --- a/test/test_unordered_multiset.cpp +++ b/test/test_unordered_multiset.cpp @@ -283,7 +283,7 @@ namespace other_data = data; - bool isEqual = std::equal(data.begin(), + bool isEqual = etl::equal(data.begin(), data.end(), other_data.begin()); @@ -301,7 +301,7 @@ namespace idata2 = idata1; - bool isEqual = std::equal(data1.begin(), + bool isEqual = etl::equal(data1.begin(), data1.end(), data2.begin()); @@ -318,7 +318,7 @@ namespace other_data = other_data; #include "etl/private/diagnostic_pop.h" - bool isEqual = std::equal(data.begin(), + bool isEqual = etl::equal(data.begin(), data.end(), other_data.begin()); diff --git a/test/test_unordered_set.cpp b/test/test_unordered_set.cpp index 507ab4ce..c45caaa1 100644 --- a/test/test_unordered_set.cpp +++ b/test/test_unordered_set.cpp @@ -267,7 +267,7 @@ namespace other_data = data; - bool isEqual = std::equal(data.begin(), + bool isEqual = etl::equal(data.begin(), data.end(), other_data.begin()); @@ -285,7 +285,7 @@ namespace idata2 = idata1; - bool isEqual = std::equal(data1.begin(), + bool isEqual = etl::equal(data1.begin(), data1.end(), data2.begin()); @@ -302,7 +302,7 @@ namespace other_data = other_data; #include "etl/private/diagnostic_pop.h" - bool isEqual = std::equal(data.begin(), + bool isEqual = etl::equal(data.begin(), data.end(), other_data.begin());