Skip to content

Commit 73c90a2

Browse files
authored
Merge pull request #865 from xtensor-stack/feature/support-no-except
Make xsimd compatible with -fno-exceptions
2 parents 68d5d3e + c057c2e commit 73c90a2

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: C++ -fno-except compatibility
2+
on: [push, pull_request]
3+
jobs:
4+
build:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v2
8+
- name: Install dependencies
9+
run: |
10+
sudo apt install g++ cmake
11+
- name: Setup
12+
run: |
13+
mkdir _build
14+
cd _build && cmake .. -DBUILD_TESTS=ON -DDOWNLOAD_DOCTEST=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-fno-exceptions
15+
- name: Build
16+
run: cmake --build _build
17+

include/xsimd/memory/xsimd_aligned_allocator.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,10 @@ namespace xsimd
171171
aligned_allocator<T, A>::allocate(size_type n, const void*) -> pointer
172172
{
173173
pointer res = reinterpret_cast<pointer>(aligned_malloc(sizeof(T) * n, A));
174+
#if defined(_CPPUNWIND) || defined(__cpp_exceptions)
174175
if (res == nullptr)
175176
throw std::bad_alloc();
177+
#endif
176178
return res;
177179
}
178180

0 commit comments

Comments
 (0)