-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fake allocator traits for vector, update ci, fix vector::clear (#178)
- Loading branch information
1 parent
b9b3a54
commit 15f3d57
Showing
12 changed files
with
326 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,24 +9,28 @@ on: | |
types: | ||
- published | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
formatting: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install clang-format | ||
env: | ||
DEBIAN_FRONTEND: noninteractive | ||
run: | | ||
wget https://apt.llvm.org/llvm.sh | ||
chmod +x llvm.sh | ||
sudo ./llvm.sh 15 | ||
sudo ./llvm.sh 16 | ||
rm llvm.sh | ||
sudo apt-get install -y --no-install-recommends clang-format-15 | ||
sudo apt-get install -y --no-install-recommends clang-format-16 | ||
- name: Format files | ||
run: find include test -type f -a \( -name "*.cc" -o -name "*.h" \) -print0 | xargs -0 clang-format-15 -i | ||
run: find include test -type f -a \( -name "*.cc" -o -name "*.h" \) -print0 | xargs -0 clang-format-16 -i | ||
|
||
- name: Check for differences | ||
run: | | ||
|
@@ -37,51 +41,55 @@ jobs: | |
strategy: | ||
matrix: | ||
config: | ||
- name: GCC 10 Release | ||
cxx: g++-10 | ||
cc: gcc-10 | ||
- name: GCC 11 Release | ||
cxx: g++-11 | ||
cc: gcc-11 | ||
mode: Release | ||
- name: GCC 10 Debug | ||
cxx: g++-10 | ||
cc: gcc-10 | ||
- name: GCC 11 Debug | ||
cxx: g++-11 | ||
cc: gcc-11 | ||
mode: Debug | ||
valgrind: true | ||
- name: Clang 15 Release | ||
cxx: clang++-15 | ||
cc: clang-15 | ||
- name: Clang 16 Release | ||
cxx: clang++-16 | ||
cc: clang-16 | ||
mode: Release | ||
cxxflags: -stdlib=libc++ | ||
ldflags: -lc++abi | ||
- name: Clang 15 Debug | ||
cxx: clang++-15 | ||
cc: clang-15 | ||
- name: Clang 16 Debug | ||
cxx: clang++-16 | ||
cc: clang-16 | ||
mode: Debug | ||
fuzz: true | ||
- key: GCC 10 Sanitizer | ||
cxx: g++-10 | ||
cc: gcc-10 | ||
- key: GCC 11 Sanitizer | ||
cxx: g++-11 | ||
cc: gcc-11 | ||
mode: Debug | ||
cflags: -fsanitize=address,undefined -fno-omit-frame-pointer | ||
cxxflags: -fsanitize=address,undefined -fno-omit-frame-pointer | ||
|
||
env: | ||
UBSAN_OPTIONS: halt_on_error=1:abort_on_error=1 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: seanmiddleditch/gha-setup-ninja@master | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install Ninja | ||
env: | ||
DEBIAN_FRONTEND: noninteractive | ||
run: sudo apt-get install -y --no-install-recommends ninja-build | ||
|
||
# ==== INSTALL ==== | ||
- name: Install | ||
if: matrix.config.cc == 'clang-15' | ||
- name: Install Clang | ||
if: matrix.config.cc == 'clang-16' | ||
env: | ||
DEBIAN_FRONTEND: noninteractive | ||
run: | | ||
sudo apt-get update | ||
wget https://apt.llvm.org/llvm.sh | ||
chmod +x llvm.sh | ||
sudo ./llvm.sh 15 || sudo ./llvm.sh 15 workaround | ||
sudo ./llvm.sh 16 || sudo ./llvm.sh 16 workaround | ||
rm llvm.sh | ||
sudo apt-get install -y --no-install-recommends libstdc++-12-dev libc++-15-dev libc++abi-15-dev clang-tidy-15 libunwind-15-dev llvm-15 libfuzzer-15-dev | ||
sudo apt-get install -y --no-install-recommends libstdc++-12-dev libc++-16-dev libc++abi-16-dev clang-tidy-16 libunwind-16-dev llvm-16 libfuzzer-16-dev | ||
# ==== BUILD ==== | ||
- name: CMake | ||
|
@@ -95,7 +103,7 @@ jobs: | |
-DCMAKE_CXX_LINKER_FLAGS=${{ matrix.config.ldflags }}" \ | ||
-DCMAKE_CXX_EXE_LINKER_FLAGS="${{ matrix.config.ldflags }} \ | ||
-DCMAKE_BUILD_TYPE=${{ matrix.config.mode }} \ | ||
-DCISTA_ZERO_OUT=${{ matrix.config.mode == 'Debug' && matrix.config.cc == 'gcc-10' }} | ||
-DCISTA_ZERO_OUT=${{ matrix.config.mode == 'Debug' && matrix.config.cc == 'gcc-11' }} | ||
- name: Build | ||
run: cmake --build build --target cista-test cista-test-single-header | ||
|
||
|
@@ -127,15 +135,15 @@ jobs: | |
|
||
# ==== DISTRIBUTION ==== | ||
- name: Upload Distribution | ||
if: matrix.config.mode == 'Release' && matrix.config.cc == 'gcc-10' | ||
if: matrix.config.mode == 'Release' && matrix.config.cc == 'gcc-11' | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: cista.h | ||
path: build/cista.h | ||
|
||
# ==== RELEASE ==== | ||
- name: Upload Release | ||
if: github.event.action == 'published' && matrix.config.mode == 'Release' && matrix.config.cc == 'gcc-10' | ||
if: github.event.action == 'published' && matrix.config.mode == 'Release' && matrix.config.cc == 'gcc-11' | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#pragma once | ||
|
||
#include <memory> | ||
|
||
namespace cista { | ||
|
||
template <typename T, template <typename> typename Ptr> | ||
class allocator : public std::allocator<T> { | ||
public: | ||
using size_type = std::size_t; | ||
using pointer = Ptr<T>; | ||
using const_pointer = Ptr<T const>; | ||
|
||
template <typename T1> | ||
struct rebind { | ||
using other = allocator<T1, Ptr>; | ||
}; | ||
|
||
using std::allocator<T>::allocator; | ||
using std::allocator<T>::allocate; | ||
using std::allocator<T>::deallocate; | ||
}; | ||
|
||
} // namespace cista |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#pragma once | ||
|
||
#include <utility> | ||
|
||
#include "cista/decay.h" | ||
#include "cista/reflection/comparable.h" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.